incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1005048 - in /sling/trunk/bundles/commons/threads: pom.xml src/main/java/org/apache/sling/commons/threads/ThreadPoolManager.java src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java
Date Wed, 06 Oct 2010 14:16:17 GMT
Author: cziegeler
Date: Wed Oct  6 14:16:16 2010
New Revision: 1005048

URL: http://svn.apache.org/viewvc?rev=1005048&view=rev
Log:
SLING-1821 :  Custom thread pools should get an optional label

Modified:
    sling/trunk/bundles/commons/threads/pom.xml
    sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/ThreadPoolManager.java
    sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java

Modified: sling/trunk/bundles/commons/threads/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/threads/pom.xml?rev=1005048&r1=1005047&r2=1005048&view=diff
==============================================================================
--- sling/trunk/bundles/commons/threads/pom.xml (original)
+++ sling/trunk/bundles/commons/threads/pom.xml Wed Oct  6 14:16:16 2010
@@ -58,7 +58,7 @@
                             org.apache.sling.commons.threads.impl.Activator
                         </Bundle-Activator>
                         <Export-Package>
-                            org.apache.sling.commons.threads;version=3.0.0
+                            org.apache.sling.commons.threads;version=3.1.0
                         </Export-Package>
                         <Private-Package>
                             org.apache.sling.commons.threads.impl

Modified: sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/ThreadPoolManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/ThreadPoolManager.java?rev=1005048&r1=1005047&r2=1005048&view=diff
==============================================================================
--- sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/ThreadPoolManager.java
(original)
+++ sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/ThreadPoolManager.java
Wed Oct  6 14:16:16 2010
@@ -47,6 +47,18 @@ public interface ThreadPoolManager {
     ThreadPool create(ThreadPoolConfig config);
 
     /**
+     * Create a new thread pool with this configuration.
+     * A thread pool must be released when not used anymore with the
+     * {@link #release(ThreadPool)} method.
+     * @param config The thread pool configuration.
+     * @param label  An optional label for the thread pool. The label
+     *               will be appended to the name of the pool.
+     * @return A new thread pool.
+     * @since 3.1
+     */
+    ThreadPool create(ThreadPoolConfig config, String label);
+
+    /**
      * Release the thread pool again.
      */
     void release(ThreadPool pool);

Modified: sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java?rev=1005048&r1=1005047&r2=1005048&view=diff
==============================================================================
--- sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java
(original)
+++ sling/trunk/bundles/commons/threads/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java
Wed Oct  6 14:16:16 2010
@@ -154,10 +154,15 @@ public class DefaultThreadPoolManager
      * @see org.apache.sling.commons.threads.ThreadPoolManager#create(org.apache.sling.commons.threads.ThreadPoolConfig)
      */
     public ThreadPool create(ThreadPoolConfig config) {
+        return this.create(config, null);
+    }
+
+    public ThreadPool create(ThreadPoolConfig config, String label) {
         if ( config == null ) {
             throw new IllegalArgumentException("Config must not be null.");
         }
-        final String name = "ThreadPool-" + UUID.randomUUID().toString();
+        final String name = "ThreadPool-" + UUID.randomUUID().toString() +
+             (label == null ? "" : " (" + label + ")");
         final Entry entry = new Entry(null, config, name);
         synchronized ( this.pools ) {
             this.pools.put(name, entry);



Mime
View raw message