sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1636835 - in /sling/trunk/bundles/extensions/event/src: main/java/org/apache/sling/event/impl/jobs/Utility.java main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java test/java/org/apache/sling/event/it/ChaosTest.java
Date Wed, 05 Nov 2014 09:33:28 GMT
Author: cziegeler
Date: Wed Nov  5 09:33:27 2014
New Revision: 1636835

URL: http://svn.apache.org/r1636835
Log:
SLING-4134 : Add switch to surpress deprecation log entries

Modified:
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java
    sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ChaosTest.java

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java?rev=1636835&r1=1636834&r2=1636835&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java
Wed Nov  5 09:33:27 2014
@@ -45,6 +45,8 @@ public abstract class Utility {
     public static final String PROPERTY_LOCK_CREATED_APP = "lock.created.app";
     public static final String RESOURCE_TYPE_LOCK = "slingevent:Lock";
 
+    public static volatile boolean LOG_DEPRECATION_WARNINGS = true;
+
     /**
      * Check the job topic.
      * @return <code>null</code> if the topic is correct, otherwise an error
description is returned
@@ -295,7 +297,7 @@ public abstract class Utility {
      * @param message The message.
      */
     public static void logDeprecated(final Logger logger, final String message) {
-        if ( logger.isInfoEnabled() ) {
+        if ( LOG_DEPRECATION_WARNINGS && logger.isInfoEnabled() ) {
             logger.info("DEPRECATION-WARNING: " + message, new Exception(message));
         }
     }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java?rev=1636835&r1=1636834&r2=1636835&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java
Wed Nov  5 09:33:27 2014
@@ -44,6 +44,7 @@ import org.apache.sling.discovery.Topolo
 import org.apache.sling.discovery.TopologyEvent.Type;
 import org.apache.sling.discovery.TopologyEventListener;
 import org.apache.sling.event.impl.EnvironmentComponent;
+import org.apache.sling.event.impl.jobs.Utility;
 import org.apache.sling.event.impl.jobs.tasks.CheckTopologyTask;
 import org.apache.sling.event.impl.jobs.tasks.FindUnfinishedJobsTask;
 import org.apache.sling.event.impl.jobs.tasks.UpgradeTask;
@@ -68,6 +69,10 @@ import org.slf4j.LoggerFactory;
               label="Disable Distribution",
               description="If the distribution is disabled, all jobs will be processed on
the leader only! "
                         + "Please use this switch with care."),
+    @Property(name=JobManagerConfiguration.PROPERTY_LOG_DEPRECATION_WARNINGS,
+              boolValue=JobManagerConfiguration.DEFAULT_LOG_DEPRECATION_WARNINGS,
+              label="Deprecation Warnings",
+              description="If this switch is enabled, deprecation warnings will be logged
with the INFO level."),
     @Property(name=JobManagerConfiguration.PROPERTY_REPOSITORY_PATH,
               value=JobManagerConfiguration.DEFAULT_REPOSITORY_PATH, propertyPrivate=true),
     @Property(name=JobManagerConfiguration.PROPERTY_SCHEDULED_JOBS_PATH,
@@ -107,6 +112,12 @@ public class JobManagerConfiguration imp
     /** Default value for background loading. */
     public static final boolean DEFAULT_BACKGROUND_LOAD_SEARCH = true;
 
+    /** Configuration property for deprecation warnings. */
+    public static final String PROPERTY_LOG_DEPRECATION_WARNINGS = "job.log.deprecation";
+
+    /** Default value for deprecation warnings. */
+    public static final boolean DEFAULT_LOG_DEPRECATION_WARNINGS = true;
+
     /** The jobs base path with a slash. */
     private String jobsBasePathWithSlash;
 
@@ -217,6 +228,7 @@ public class JobManagerConfiguration imp
     protected void update(final Map<String, Object> props) {
         this.disabledDistribution = PropertiesUtil.toBoolean(props.get(PROPERTY_DISABLE_DISTRIBUTION),
DEFAULT_DISABLE_DISTRIBUTION);
         this.backgroundLoadDelay = PropertiesUtil.toLong(props.get(PROPERTY_BACKGROUND_LOAD_DELAY),
DEFAULT_BACKGROUND_LOAD_DELAY);
+        Utility.LOG_DEPRECATION_WARNINGS = PropertiesUtil.toBoolean(props.get(PROPERTY_LOG_DEPRECATION_WARNINGS),
DEFAULT_LOG_DEPRECATION_WARNINGS);
     }
 
     /**

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ChaosTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ChaosTest.java?rev=1636835&r1=1636834&r2=1636835&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ChaosTest.java
(original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ChaosTest.java
Wed Nov  5 09:33:27 2014
@@ -196,6 +196,7 @@ public class ChaosTest extends AbstractJ
             this.jobManager = jobManager;
             this.created = created;
             this.finishedThreads = finishedThreads;
+            this.setDaemon(true);
         }
 
         @Override
@@ -280,6 +281,7 @@ public class ChaosTest extends AbstractJ
 
                 @Override
                 public void run() {
+                    this.setDaemon(true);
                     final long startTime = System.currentTimeMillis();
                     // this thread runs 30 seconds longer than the job creation thread
                     final long endTime = startTime + (DURATION +30) * 1000;



Mime
View raw message