incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r891678 - in /sling/trunk/bundles/extensions/event: ./ src/main/java/org/apache/sling/event/ src/main/java/org/apache/sling/event/impl/ src/test/java/org/apache/sling/event/impl/
Date Thu, 17 Dec 2009 12:48:12 GMT
Author: cziegeler
Date: Thu Dec 17 12:48:03 2009
New Revision: 891678

URL: http://svn.apache.org/viewvc?rev=891678&view=rev
Log:
SLING-1248 : Use new commons threads

Modified:
    sling/trunk/bundles/extensions/event/pom.xml
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/EventUtil.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventHelper.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventingThreadPool.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java
    sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/AbstractRepositoryEventHandlerTest.java

Modified: sling/trunk/bundles/extensions/event/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/pom.xml?rev=891678&r1=891677&r2=891678&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/pom.xml (original)
+++ sling/trunk/bundles/extensions/event/pom.xml Thu Dec 17 12:48:03 2009
@@ -29,7 +29,7 @@
 
     <artifactId>org.apache.sling.event</artifactId>
     <packaging>bundle</packaging>
-    <version>2.0.7-SNAPSHOT</version>
+    <version>2.1.0-SNAPSHOT</version>
 
     <name>Apache Sling Event Support</name>
     <description>
@@ -55,13 +55,10 @@
                 <configuration>
                     <instructions>
                         <Export-Package>
-                            org.apache.sling.event;version=2.0.8
+                            org.apache.sling.event;version=2.1.0
                         </Export-Package>
                         <Private-Package>
-                            org.apache.sling.event.impl,
-                            org.apache.jackrabbit,
-                            org.apache.jackrabbit.util,
-                            org.apache.jackrabbit.name
+                            org.apache.sling.event.impl
                         </Private-Package>
                         <Sling-Nodetypes>
                             SLING-INF/nodetypes/event.cnd
@@ -69,6 +66,9 @@
                         <Sling-Namespaces>
                             slingevent=http://sling.apache.org/jcr/event/1.0
                         </Sling-Namespaces>
+                        <Embed-Dependency>
+                            jackrabbit-jcr-commons;inline="org/apache/jackrabbit/util/ISO9075.*|org/apache/jackrabbit/util/ISO8601.*"
+                        </Embed-Dependency>
                     </instructions>
                 </configuration>
             </plugin>
@@ -104,36 +104,43 @@
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
             <version>2.0.8</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.engine</artifactId>
             <version>2.0.6</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.jcr.api</artifactId>
             <version>2.0.2-incubator</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.jcr.resource</artifactId>
             <version>2.0.6</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.scheduler</artifactId>
             <version>2.1.0</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.threads</artifactId>
-            <version>2.0.2-incubator</version>
+            <version>3.0.0-SNAPSHOT</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.classloader</artifactId>
             <version>1.0.0</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
@@ -143,7 +150,7 @@
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-jcr-commons</artifactId>
             <version>1.4.2</version>
-            <scope>compile</scope>
+            <scope>provided</scope>
         </dependency>
         <!-- Testing -->
         <dependency>

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/EventUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/EventUtil.java?rev=891678&r1=891677&r2=891678&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/EventUtil.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/EventUtil.java
Thu Dec 17 12:48:03 2009
@@ -247,6 +247,7 @@
                 notify = false;
             }
         }
+        LoggerFactory.getLogger(EventUtil.class).info("Send ack for {}", job.hashCode());
         final boolean notifyResult = notify;
 
         final Runnable task = new Runnable() {
@@ -256,6 +257,7 @@
              */
             public void run() {
                 boolean result = false;
+                LoggerFactory.getLogger(EventUtil.class).info("Processing {}", job.hashCode());
                 try {
                     result = processor.process(job);
                 } catch (Throwable t) {

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventHelper.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventHelper.java?rev=891678&r1=891677&r2=891678&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventHelper.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventHelper.java
Thu Dec 17 12:48:03 2009
@@ -51,9 +51,6 @@
  */
 public abstract class EventHelper {
 
-    /** The name of the thread pool for the eventing stuff. */
-    public static final String THREAD_POOL_NAME = "SLING_EVENTING";
-
     /** The namespace prefix. */
     public static final String EVENT_PREFIX = "slingevent:";
 

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventingThreadPool.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventingThreadPool.java?rev=891678&r1=891677&r2=891678&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventingThreadPool.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventingThreadPool.java
Thu Dec 17 12:48:03 2009
@@ -19,6 +19,7 @@
 package org.apache.sling.event.impl;
 
 import org.apache.sling.commons.osgi.OsgiUtil;
+import org.apache.sling.commons.threads.ModifiableThreadPoolConfig;
 import org.apache.sling.commons.threads.ThreadPoolConfig;
 import org.apache.sling.commons.threads.ThreadPoolManager;
 import org.apache.sling.event.ThreadPool;
@@ -59,17 +60,12 @@
         if ( this.threadPoolManager == null ) {
             throw new Exception("No ThreadPoolManager found.");
         }
-        final ThreadPoolConfig config = new ThreadPoolConfig();
+        final ModifiableThreadPoolConfig config = new ModifiableThreadPoolConfig();
         config.setMinPoolSize(OsgiUtil.toInteger(ctx.getProperties().get(PROPERTY_MIN_POOL_SIZE),
DEFAULT_MIN_POOL_SIZE));
         config.setMaxPoolSize(OsgiUtil.toInteger(ctx.getProperties().get(PROPERTY_MAX_POOL_SIZE),
DEFAULT_MAX_POOL_SIZE));
         config.setQueueSize(OsgiUtil.toInteger(ctx.getProperties().get(PROPERTY_QUEUEL_SIZE),
DEFAULT_QUEUE_SIZE));
         config.setShutdownGraceful(true);
-        threadPoolManager.create(EventHelper.THREAD_POOL_NAME, config);
-
-        this.threadPool = threadPoolManager.get(EventHelper.THREAD_POOL_NAME);
-        if ( this.threadPool == null ) {
-            throw new Exception("No thread pool with name " + EventHelper.THREAD_POOL_NAME
+ " found.");
-        }
+        this.threadPool = threadPoolManager.create(config);
     }
 
     /**
@@ -77,7 +73,7 @@
      * @param context
      */
     protected void deactivate(final ComponentContext context) {
-        this.threadPool = null;
+        this.threadPoolManager.release(this.threadPool);
     }
 
     /**
@@ -100,11 +96,4 @@
     public String getName() {
         return threadPool.getName();
     }
-
-    /**
-     * @see org.apache.sling.commons.threads.ThreadPool#shutdown()
-     */
-    public void shutdown() {
-        threadPool.shutdown();
-    }
 }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java?rev=891678&r1=891677&r2=891678&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java
Thu Dec 17 12:48:03 2009
@@ -935,7 +935,9 @@
                 // we need async delivery, otherwise we might create a deadlock
                 // as this method runs inside a synchronized block and the finishedJob
                 // method as well!
+                logger.info("Posting event {}", jobEvent.hashCode());
                 localEA.postEvent(jobEvent);
+                logger.info("Posted event {}", jobEvent.hashCode());
                 // do not unlock if sending was successful
                 unlock = false;
             } else {

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/AbstractRepositoryEventHandlerTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/AbstractRepositoryEventHandlerTest.java?rev=891678&r1=891677&r2=891678&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/AbstractRepositoryEventHandlerTest.java
(original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/AbstractRepositoryEventHandlerTest.java
Thu Dec 17 12:48:03 2009
@@ -32,6 +32,7 @@
 import javax.jcr.observation.EventListenerIterator;
 
 import org.apache.sling.commons.testing.jcr.RepositoryUtil;
+import org.apache.sling.commons.threads.ModifiableThreadPoolConfig;
 import org.apache.sling.commons.threads.ThreadPoolConfig;
 import org.apache.sling.engine.SlingSettingsService;
 import org.apache.sling.event.ThreadPool;
@@ -162,15 +163,11 @@
         }
 
         public String getName() {
-            return EventHelper.THREAD_POOL_NAME;
-        }
-
-        public void shutdown() {
-            // nothing to do
+            return "default";
         }
 
         public ThreadPoolConfig getConfiguration() {
-            return new ThreadPoolConfig();
+            return new ModifiableThreadPoolConfig();
         }
 
     }



Mime
View raw message