summaryrefslogtreecommitdiffstats
path: root/java/sca
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca')
-rw-r--r--java/sca/itest/validation/src/test/java/binding/ejb/UnknownEJBSessionTypeTestCase.java28
-rw-r--r--java/sca/itest/validation/src/test/java/binding/ejb/UnknownEJBVersionTestCase.java3
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java16
3 files changed, 30 insertions, 17 deletions
diff --git a/java/sca/itest/validation/src/test/java/binding/ejb/UnknownEJBSessionTypeTestCase.java b/java/sca/itest/validation/src/test/java/binding/ejb/UnknownEJBSessionTypeTestCase.java
index 1cef8a902e..ff94ad7b93 100644
--- a/java/sca/itest/validation/src/test/java/binding/ejb/UnknownEJBSessionTypeTestCase.java
+++ b/java/sca/itest/validation/src/test/java/binding/ejb/UnknownEJBSessionTypeTestCase.java
@@ -31,33 +31,37 @@ import domain.CustomCompositeBuilder;
*/
public class UnknownEJBSessionTypeTestCase extends TestCase {
- private CustomCompositeBuilder customDomain;
+ private CustomCompositeBuilder customDomain;
@Override
protected void setUp() throws Exception {
- System.setProperty("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
+ System.setProperty("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
System.setProperty("java.naming.provider.url", "ejbd://localhost:8085");
- System.setProperty("managed", "false");
-
+ System.setProperty("managed", "false");
+
customDomain = CustomCompositeBuilder.getInstance();
try {
- customDomain.loadContribution("src/main/resources/bindingejb/UnknownEJBSessionType/account.composite",
- "TestContribution", "src/main/resources/bindingejb/UnknownEJBSessionType/");
- } catch (Exception ex){
+ customDomain.loadContribution("src/main/resources/bindingejb/UnknownEJBSessionType/account.composite",
+ "TestContribution",
+ "src/main/resources/bindingejb/UnknownEJBSessionType/");
+ } catch (Exception ex) {
//throw ex;
}
}
@Override
protected void tearDown() throws Exception {
+ System.clearProperty("java.naming.factory.initial");
+ System.clearProperty("java.naming.provider.url");
+ System.clearProperty("managed");
//node.stop();
}
public void testCalculator() {
- Monitor monitor = customDomain.getMonitorInstance();
- Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
-
- assertNotNull(problem);
- assertEquals("UnknownEJBSessionType", problem.getMessageId());
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnknownEJBSessionType", problem.getMessageId());
}
}
diff --git a/java/sca/itest/validation/src/test/java/binding/ejb/UnknownEJBVersionTestCase.java b/java/sca/itest/validation/src/test/java/binding/ejb/UnknownEJBVersionTestCase.java
index bacddc93a8..a192674aeb 100644
--- a/java/sca/itest/validation/src/test/java/binding/ejb/UnknownEJBVersionTestCase.java
+++ b/java/sca/itest/validation/src/test/java/binding/ejb/UnknownEJBVersionTestCase.java
@@ -50,6 +50,9 @@ public class UnknownEJBVersionTestCase extends TestCase {
@Override
protected void tearDown() throws Exception {
+ System.clearProperty("java.naming.factory.initial");
+ System.clearProperty("java.naming.provider.url");
+ System.clearProperty("managed");
//node.stop();
}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java
index b331517c85..90c13e6da8 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java
@@ -56,16 +56,22 @@ public class Jsr237WorkScheduler implements WorkScheduler {
* @param jsr237WorkManager JSR 237 work manager.
*/
public Jsr237WorkScheduler() {
-
+ }
+
+ private synchronized WorkManager getWorkManager() {
+ if (jsr237WorkManager != null) {
+ return jsr237WorkManager;
+ }
try {
- InitialContext ctx = new InitialContext();
- jsr237WorkManager = (WorkManager) ctx.lookup("java:comp/env/wm/TuscanyWorkManager");
+ InitialContext ctx = new InitialContext();
+ jsr237WorkManager = (WorkManager)ctx.lookup("java:comp/env/wm/TuscanyWorkManager");
} catch (NamingException e) {
// ignore
}
if (jsr237WorkManager == null) {
jsr237WorkManager = new ThreadPoolWorkManager(10);
}
+ return jsr237WorkManager;
}
/**
@@ -94,10 +100,10 @@ public class Jsr237WorkScheduler implements WorkScheduler {
Jsr237Work<T> jsr237Work = new Jsr237Work<T>(work);
try {
if (listener == null) {
- jsr237WorkManager.schedule(jsr237Work);
+ getWorkManager().schedule(jsr237Work);
} else {
Jsr237WorkListener<T> jsr237WorkListener = new Jsr237WorkListener<T>(listener, work);
- jsr237WorkManager.schedule(jsr237Work, jsr237WorkListener);
+ getWorkManager().schedule(jsr237Work, jsr237WorkListener);
}
} catch (IllegalArgumentException ex) {
if (listener != null) {