tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r568019 - in /incubator/tuscany/java/sca/modules: core-spi/src/main/java/org/apache/tuscany/sca/work/ core-spi/src/main/resources/META-INF/services/ core/src/main/java/org/apache/tuscany/sca/core/work/ host-embedded/src/main/java/org/apache...
Date Tue, 21 Aug 2007 08:33:01 GMT
Author: antelder
Date: Tue Aug 21 01:33:00 2007
New Revision: 568019

URL: http://svn.apache.org/viewvc?rev=568019&view=rev
Log:
TUSCANY-1554, apply patch from Greg Dritschlerto support alternate WorkScheduler implementations

Added:
    incubator/tuscany/java/sca/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler
Modified:
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
    incubator/tuscany/java/sca/modules/http-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java
    incubator/tuscany/java/sca/modules/http-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java?rev=568019&r1=568018&r2=568019&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java
(original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java
Tue Aug 21 01:33:00 2007
@@ -49,4 +49,9 @@
      */
     <T extends Runnable>void scheduleWork(T work);
 
+    /**
+     * Destroys the work scheduler
+     */
+    void destroy();
+
 }

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler?rev=568019&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler
(added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler
Tue Aug 21 01:33:00 2007
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.core.work.Jsr237WorkScheduler

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java?rev=568019&r1=568018&r2=568019&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java
(original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java
Tue Aug 21 01:33:00 2007
@@ -40,18 +40,15 @@
     /**
      * Underlying JSR-237 work manager
      */
-    private WorkManager jsr237WorkManager;
+    private ThreadPoolWorkManager jsr237WorkManager;
 
     /**
      * Initializes the JSR 237 work manager.
      *
      * @param jsr237WorkManager JSR 237 work manager.
      */
-    public Jsr237WorkScheduler(WorkManager jsr237WorkManager) {
-        if (jsr237WorkManager == null) {
-            throw new IllegalArgumentException("Work manager cannot be null");
-        }
-        this.jsr237WorkManager = jsr237WorkManager;
+    public Jsr237WorkScheduler() {
+        jsr237WorkManager = new ThreadPoolWorkManager(10);
     }
 
     /**
@@ -95,6 +92,10 @@
             throw new WorkSchedulerException(ex);
         }
 
+    }
+
+    public void destroy() {
+        jsr237WorkManager.destroy();
     }
 
     /*

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java?rev=568019&r1=568018&r2=568019&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
(original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
Tue Aug 21 01:33:00 2007
@@ -40,7 +40,6 @@
 import org.apache.tuscany.sca.core.runtime.ActivationException;
 import org.apache.tuscany.sca.core.runtime.CompositeActivator;
 import org.apache.tuscany.sca.core.runtime.RuntimeAssemblyFactory;
-import org.apache.tuscany.sca.core.work.ThreadPoolWorkManager;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
 import org.apache.tuscany.sca.interfacedef.impl.TempServiceDeclarationUtil;
@@ -48,6 +47,7 @@
 import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.apache.tuscany.sca.scope.ScopeRegistry;
+import org.apache.tuscany.sca.work.WorkScheduler;
 
 public class ReallySmallRuntime {
 
@@ -59,7 +59,7 @@
     private ContributionService contributionService;
     private CompositeActivator compositeActivator;
     private CompositeBuilder compositeBuilder;
-    private ThreadPoolWorkManager workManager;
+    private WorkScheduler workScheduler;
     private ScopeRegistry scopeRegistry;
 
     public ReallySmallRuntime(ClassLoader classLoader) {
@@ -71,8 +71,8 @@
         // Create our extension point registry
         registry = new DefaultExtensionPointRegistry();
 
-        // Create a work manager
-        workManager = new ThreadPoolWorkManager(10);
+//      Get work scheduler
+        workScheduler = registry.getExtensionPoint(WorkScheduler.class);
 
         // Create an interface contract mapper
         InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
@@ -123,7 +123,7 @@
                                                                                 mapper,
                                                                                 proxyFactory,
                                                                                 scopeRegistry,
-                                                                                workManager);
+                                                                                workScheduler);
 
         // Load the runtime modules
         modules = loadModules(registry, classLoader);
@@ -138,7 +138,7 @@
         stopModules(registry, modules);
 
         // Stop and destroy the work manager
-        workManager.destroy();
+        workScheduler.destroy();
 
         // Cleanup
         modules = null;
@@ -146,7 +146,7 @@
         assemblyFactory = null;
         contributionService = null;
         compositeActivator = null;
-        workManager = null;
+        workScheduler = null;
         scopeRegistry = null;
     }
 

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java?rev=568019&r1=568018&r2=568019&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
(original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
Tue Aug 21 01:33:00 2007
@@ -71,7 +71,6 @@
 import org.apache.tuscany.sca.core.scope.RequestScopeContainerFactory;
 import org.apache.tuscany.sca.core.scope.ScopeRegistryImpl;
 import org.apache.tuscany.sca.core.scope.StatelessScopeContainerFactory;
-import org.apache.tuscany.sca.core.work.Jsr237WorkScheduler;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
 import org.apache.tuscany.sca.invocation.MessageFactory;
@@ -83,8 +82,6 @@
 import org.apache.tuscany.sca.scope.ScopeRegistry;
 import org.apache.tuscany.sca.work.WorkScheduler;
 
-import commonj.work.WorkManager;
-
 public class ReallySmallRuntimeBuilder {
 
     public static ProxyFactory createProxyFactory(ExtensionPointRegistry registry,
@@ -106,12 +103,7 @@
                                                               InterfaceContractMapper mapper,
                                                               ProxyFactory proxyFactory,
                                                               ScopeRegistry scopeRegistry,
-                                                              WorkManager workManager) {
-
-        // Create a work scheduler
-        //FIXME Pass the work scheduler differently as it's not an extension point
-        WorkScheduler workScheduler = new Jsr237WorkScheduler(workManager);
-        registry.addExtensionPoint(workScheduler);
+                                                              WorkScheduler workScheduler)
{
 
         // Create a wire post processor extension point
         RuntimeWireProcessorExtensionPoint wireProcessors = registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);

Modified: incubator/tuscany/java/sca/modules/http-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/http-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java?rev=568019&r1=568018&r2=568019&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/http-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/http-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java
Tue Aug 21 01:33:00 2007
@@ -72,6 +72,9 @@
         public <T extends Runnable> void scheduleWork(T work, NotificationListener<T>
listener) {
             scheduleWork(work);
         }
+
+        public void destroy() {
+        }
     };
 
     /**

Modified: incubator/tuscany/java/sca/modules/http-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/http-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java?rev=568019&r1=568018&r2=568019&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/http-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/http-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java
Tue Aug 21 01:33:00 2007
@@ -71,6 +71,9 @@
         public <T extends Runnable> void scheduleWork(T work, NotificationListener<T>
listener) {
             scheduleWork(work);
         }
+
+        public void destroy() {
+        }
     };
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message