You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by to...@apache.org on 2017/05/11 12:12:12 UTC

svn commit: r1794817 - in /sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution: monitor/impl/ serialization/impl/ serialization/impl/vlt/

Author: tommaso
Date: Thu May 11 12:12:12 2017
New Revision: 1794817

URL: http://svn.apache.org/viewvc?rev=1794817&view=rev
Log:
SLING-6848 - package level monitoring not enabled by default

Modified:
    sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/monitor/impl/MonitoringDistributionPackageBuilder.java
    sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/serialization/impl/DistributionPackageBuilderFactory.java
    sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VaultDistributionPackageBuilderFactory.java

Modified: sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/monitor/impl/MonitoringDistributionPackageBuilder.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/monitor/impl/MonitoringDistributionPackageBuilder.java?rev=1794817&r1=1794816&r2=1794817&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/monitor/impl/MonitoringDistributionPackageBuilder.java (original)
+++ sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/monitor/impl/MonitoringDistributionPackageBuilder.java Thu May 11 12:12:12 2017
@@ -23,6 +23,7 @@ import java.util.Dictionary;
 import java.util.Hashtable;
 import java.util.Queue;
 import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.LinkedBlockingDeque;
 
 import javax.annotation.Nonnull;
 import javax.management.ObjectName;
@@ -51,7 +52,7 @@ public final class MonitoringDistributio
         this.context = context;
         this.queueCapacity = queueCapacity;
 
-        mBeans = new ArrayBlockingQueue<ServiceRegistration>(queueCapacity);
+        mBeans = new LinkedBlockingDeque<ServiceRegistration>();
     }
 
     @Override
@@ -64,7 +65,9 @@ public final class MonitoringDistributio
     public DistributionPackage createPackage(@Nonnull ResourceResolver resourceResolver, @Nonnull DistributionRequest request) throws DistributionException {
         long start = System.currentTimeMillis();
         DistributionPackage distributionPackage = wrapped.createPackage(resourceResolver, request);
-        registerDistributionPackageMBean(start, distributionPackage);
+        if (queueCapacity > 0) {
+            registerDistributionPackageMBean(start, distributionPackage);
+        }
         return distributionPackage;
     }
 

Modified: sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/serialization/impl/DistributionPackageBuilderFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/serialization/impl/DistributionPackageBuilderFactory.java?rev=1794817&r1=1794816&r2=1794817&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/serialization/impl/DistributionPackageBuilderFactory.java (original)
+++ sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/serialization/impl/DistributionPackageBuilderFactory.java Thu May 11 12:12:12 2017
@@ -154,7 +154,7 @@ public class DistributionPackageBuilderF
     )
     private static final String DIGEST_ALGORITHM = "digestAlgorithm";
 
-    private static final int DEFAULT_MONITORING_QUEUE_SIZE = 100;
+    private static final int DEFAULT_MONITORING_QUEUE_SIZE = 0;
 
     @Property(
         label="The number of items for monitoring distribution packages creation/installation",

Modified: sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VaultDistributionPackageBuilderFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VaultDistributionPackageBuilderFactory.java?rev=1794817&r1=1794816&r2=1794817&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VaultDistributionPackageBuilderFactory.java (original)
+++ sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VaultDistributionPackageBuilderFactory.java Thu May 11 12:12:12 2017
@@ -18,23 +18,7 @@
  */
 package org.apache.sling.distribution.serialization.impl.vlt;
 
-import java.io.InputStream;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.ConfigurationPolicy;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.PropertyOption;
-import org.apache.felix.scr.annotations.PropertyUnbounded;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
+import org.apache.felix.scr.annotations.*;
 import org.apache.jackrabbit.vault.fs.api.ImportMode;
 import org.apache.jackrabbit.vault.fs.io.AccessControlHandling;
 import org.apache.jackrabbit.vault.packaging.Packaging;
@@ -58,6 +42,13 @@ import org.apache.sling.distribution.uti
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+import java.io.InputStream;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+
 /**
  * A package builder for Apache Jackrabbit FileVault based implementations.
  */
@@ -69,7 +60,7 @@ import org.osgi.framework.ServiceRegistr
         policy = ConfigurationPolicy.REQUIRE
 )
 @Service(DistributionPackageBuilder.class)
-@Property(name="webconsole.configurationFactory.nameHint", value="Builder name: {name}")
+@Property(name = "webconsole.configurationFactory.nameHint", value = "Builder name: {name}")
 public class VaultDistributionPackageBuilderFactory implements DistributionPackageBuilder {
 
     /**
@@ -130,16 +121,16 @@ public class VaultDistributionPackageBui
     @Property(label = "Temp Filesystem Folder", description = "The filesystem folder where the temporary files should be saved.")
     private static final String TEMP_FS_FOLDER = "tempFsFolder";
 
-    @Property(label="Use Binary References", description = "If activated, it avoids sending binaries in the distribution package.", boolValue = false)
+    @Property(label = "Use Binary References", description = "If activated, it avoids sending binaries in the distribution package.", boolValue = false)
     public static final String USE_BINARY_REFERENCES = "useBinaryReferences";
 
-    @Property(label="Autosave threshold", description = "The value after which autosave is triggered for intermediate changes.", intValue = -1)
+    @Property(label = "Autosave threshold", description = "The value after which autosave is triggered for intermediate changes.", intValue = -1)
     public static final String AUTOSAVE_THRESHOLD = "autoSaveThreshold";
 
     private static final long DEFAULT_PACKAGE_CLEANUP_DELAY = 60L;
 
     @Property(
-            label="The delay in seconds between two runs of the cleanup phase for resource persisted packages.",
+            label = "The delay in seconds between two runs of the cleanup phase for resource persisted packages.",
             description = "The resource persisted packages are cleaned up periodically (asynchronously) since SLING-6503." +
                     "The delay between two runs of the cleanup phase can be configured with this setting. 60 seconds by default",
             longValue = DEFAULT_PACKAGE_CLEANUP_DELAY
@@ -150,60 +141,60 @@ public class VaultDistributionPackageBui
     private static final int DEFAULT_FILE_THRESHOLD_VALUE = 1;
 
     @Property(
-        label="File threshold (in bytes)",
-        description = "Once the data reaches the configurable size value, buffering to memory switches to file buffering.",
-        intValue = DEFAULT_FILE_THRESHOLD_VALUE
+            label = "File threshold (in bytes)",
+            description = "Once the data reaches the configurable size value, buffering to memory switches to file buffering.",
+            intValue = DEFAULT_FILE_THRESHOLD_VALUE
     )
     public static final String FILE_THRESHOLD = "fileThreshold";
 
     private static final String DEFAULT_MEMORY_UNIT = "MEGA_BYTES";
 
     @Property(
-        label = "The memory unit for the file threshold",
-        description = "The memory unit for the file threshold, Megabytes by default",
-        value = DEFAULT_MEMORY_UNIT,
-        options = {
-                @PropertyOption(name = "BYTES", value = "Bytes"),
-                @PropertyOption(name = "KILO_BYTES", value = "Kilobytes"),
-                @PropertyOption(name = "MEGA_BYTES", value = "Megabytes"),
-                @PropertyOption(name = "GIGA_BYTES", value = "Gigabytes")
-        }
+            label = "The memory unit for the file threshold",
+            description = "The memory unit for the file threshold, Megabytes by default",
+            value = DEFAULT_MEMORY_UNIT,
+            options = {
+                    @PropertyOption(name = "BYTES", value = "Bytes"),
+                    @PropertyOption(name = "KILO_BYTES", value = "Kilobytes"),
+                    @PropertyOption(name = "MEGA_BYTES", value = "Megabytes"),
+                    @PropertyOption(name = "GIGA_BYTES", value = "Gigabytes")
+            }
     )
     private static final String MEMORY_UNIT = "MEGA_BYTES";
 
     private static final boolean DEFAULT_USE_OFF_HEAP_MEMORY = false;
 
     @Property(
-        label="Flag to enable/disable the off-heap memory",
-        description = "Flag to enable/disable the off-heap memory, false by default",
-        boolValue = DEFAULT_USE_OFF_HEAP_MEMORY
+            label = "Flag to enable/disable the off-heap memory",
+            description = "Flag to enable/disable the off-heap memory, false by default",
+            boolValue = DEFAULT_USE_OFF_HEAP_MEMORY
     )
     public static final String USE_OFF_HEAP_MEMORY = "useOffHeapMemory";
 
     private static final String DEFAULT_DIGEST_ALGORITHM = "NONE";
 
     @Property(
-        label = "The digest algorithm to calculate the package checksum",
-        description = "The digest algorithm to calculate the package checksum, Megabytes by default",
-        value = DEFAULT_DIGEST_ALGORITHM,
-        options = {
-            @PropertyOption(name = DEFAULT_DIGEST_ALGORITHM, value = "Do not send digest"),
-            @PropertyOption(name = "MD2", value = "md2"),
-            @PropertyOption(name = "MD5", value = "md5"),
-            @PropertyOption(name = "SHA-1", value = "sha1"),
-            @PropertyOption(name = "SHA-256", value = "sha256"),
-            @PropertyOption(name = "SHA-384", value = "sha384"),
-            @PropertyOption(name = "SHA-512", value = "sha512")
-        }
+            label = "The digest algorithm to calculate the package checksum",
+            description = "The digest algorithm to calculate the package checksum, Megabytes by default",
+            value = DEFAULT_DIGEST_ALGORITHM,
+            options = {
+                    @PropertyOption(name = DEFAULT_DIGEST_ALGORITHM, value = "Do not send digest"),
+                    @PropertyOption(name = "MD2", value = "md2"),
+                    @PropertyOption(name = "MD5", value = "md5"),
+                    @PropertyOption(name = "SHA-1", value = "sha1"),
+                    @PropertyOption(name = "SHA-256", value = "sha256"),
+                    @PropertyOption(name = "SHA-384", value = "sha384"),
+                    @PropertyOption(name = "SHA-512", value = "sha512")
+            }
     )
     private static final String DIGEST_ALGORITHM = "digestAlgorithm";
 
-    private static final int DEFAULT_MONITORING_QUEUE_SIZE = 100;
+    private static final int DEFAULT_MONITORING_QUEUE_SIZE = 0;
 
     @Property(
-        label="The number of items for monitoring distribution packages creation/installation",
-        description = "The number of items for monitoring distribution packages creation/installation, 100 by default",
-        intValue = DEFAULT_MONITORING_QUEUE_SIZE
+            label = "The number of items for monitoring distribution packages creation/installation",
+            description = "The number of items for monitoring distribution packages creation/installation, 100 by default",
+            intValue = DEFAULT_MONITORING_QUEUE_SIZE
     )
     private static final String MONITORING_QUEUE_SIZE = "monitoringQueueSize";