tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1608107 - in /tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb: core/ core/entity/ core/ivm/ core/managed/ core/mdb/ core/security/ core/singleton/ core/stateful/ core/stateless/ core/timer/ threads/task/
Date Sat, 05 Jul 2014 18:36:24 GMT
Author: rmannibucau
Date: Sat Jul  5 18:36:23 2014
New Revision: 1608107

URL: http://svn.apache.org/r1608107
Log:
style fixes

Modified:
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseContext.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseSessionContext.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContext.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContext.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContext.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContext.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContext.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/threads/task/CUTask.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/threads/task/TriggerTask.java

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseContext.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseContext.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseContext.java
Sat Jul  5 18:36:23 2014
@@ -26,6 +26,7 @@ import org.apache.openejb.core.transacti
 import org.apache.openejb.core.transaction.TransactionPolicy;
 import org.apache.openejb.core.transaction.TransactionType;
 import org.apache.openejb.spi.SecurityService;
+import org.apache.openejb.threads.task.CUTask;
 
 import javax.ejb.EJBContext;
 import javax.ejb.EJBHome;
@@ -70,17 +71,32 @@ public abstract class BaseContext implem
         this.userTransaction = new UserTransactionWrapper(userTransaction);
     }
 
-    public abstract void check(Call call);
+    private boolean isAsyncOperation(final ThreadContext threadContext) {
+        if (threadContext.getCurrentOperation() == null
+                && threadContext.get(CUTask.Context.class) != null) {
+            return true;
+        }
+        return false;
+    }
+
+    protected abstract void check(ThreadContext context, Call call);
 
     protected IllegalStateException illegal(final Call call, final Operation operation) {
         return new IllegalStateException(call + " cannot be called in " + operation);
     }
 
     public Map<String, Object> getContextData() {
-        check(Call.getContextData);
+        doCheck(Call.getContextData);
         return ThreadContext.getThreadContext().get(InvocationContext.class).getContextData();
     }
 
+    public void doCheck(final Call call) {
+        final ThreadContext context = ThreadContext.getThreadContext();
+        if (!isAsyncOperation(context)) {
+            check(context, call);
+        }
+    }
+
     public EJBHome getEJBHome() {
         final ThreadContext threadContext = ThreadContext.getThreadContext();
         final BeanContext di = threadContext.getBeanContext();
@@ -96,7 +112,7 @@ public abstract class BaseContext implem
     }
 
     public Principal getCallerPrincipal() {
-        check(Call.getCallerPrincipal);
+        doCheck(Call.getCallerPrincipal);
         Principal callerPrincipal = getCallerPrincipal(securityService);
         if (callerPrincipal == null) {
             callerPrincipal = UnauthenticatedPrincipal.INSTANCE;
@@ -110,12 +126,12 @@ public abstract class BaseContext implem
 
     @Override
     public boolean isCallerInRole(final String s) {
-        check(Call.isCallerInRole);
+        doCheck(Call.isCallerInRole);
         return isCallerInRole(securityService, s);
     }
 
     protected boolean isCallerInRole(final SecurityService securityService, final String
roleName) {
-        check(Call.isCallerInRole);
+        doCheck(Call.isCallerInRole);
         
         final ThreadContext threadContext = ThreadContext.getThreadContext();
         final BeanContext di = threadContext.getBeanContext();
@@ -126,7 +142,7 @@ public abstract class BaseContext implem
 
     @Override
     public UserTransaction getUserTransaction() throws IllegalStateException {
-        check(Call.getUserTransaction);
+        doCheck(Call.getUserTransaction);
         return getUserTransaction(userTransaction);
     }
 
@@ -143,7 +159,7 @@ public abstract class BaseContext implem
     }
 
     public void setRollbackOnly() throws IllegalStateException {
-        check(Call.setRollbackOnly);
+        doCheck(Call.setRollbackOnly);
         final ThreadContext threadContext = ThreadContext.getThreadContext();
         final BeanContext di = threadContext.getBeanContext();
 
@@ -164,7 +180,7 @@ public abstract class BaseContext implem
     }
 
     public boolean getRollbackOnly() throws IllegalStateException {
-        check(Call.getRollbackOnly);
+        doCheck(Call.getRollbackOnly);
         final ThreadContext threadContext = ThreadContext.getThreadContext();
         final BeanContext di = threadContext.getBeanContext();
 
@@ -185,7 +201,7 @@ public abstract class BaseContext implem
     }
 
     public TimerService getTimerService() throws IllegalStateException {
-        check(Call.getTimerService);
+        doCheck(Call.getTimerService);
 
         final ThreadContext threadContext = ThreadContext.getThreadContext();
         final BeanContext beanContext = threadContext.getBeanContext();
@@ -212,7 +228,7 @@ public abstract class BaseContext implem
         final ThreadContext threadContext = ThreadContext.getThreadContext();
         final BeanContext di = threadContext.getBeanContext();
 
-        check(Call.UserTransactionMethod);
+        doCheck(Call.UserTransactionMethod);
         return di.isBeanManagedTransaction();
     }
 

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseSessionContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseSessionContext.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseSessionContext.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseSessionContext.java
Sat Jul  5 18:36:23 2014
@@ -70,7 +70,7 @@ public abstract class BaseSessionContext
     }
 
     public EJBLocalObject getEJBLocalObject() throws IllegalStateException {
-        check(Call.getEJBLocalObject);
+        doCheck(Call.getEJBLocalObject);
         final ThreadContext threadContext = ThreadContext.getThreadContext();
         final BeanContext di = threadContext.getBeanContext();
 
@@ -82,7 +82,7 @@ public abstract class BaseSessionContext
     }
 
     public EJBObject getEJBObject() throws IllegalStateException {
-        check(Call.getEJBObject);
+        doCheck(Call.getEJBObject);
         final ThreadContext threadContext = ThreadContext.getThreadContext();
         final BeanContext di = threadContext.getBeanContext();
         if (di.getHomeInterface() == null) {
@@ -93,7 +93,7 @@ public abstract class BaseSessionContext
     }
 
     public MessageContext getMessageContext() throws IllegalStateException {
-        check(Call.getMessageContext);
+        doCheck(Call.getMessageContext);
         final ThreadContext threadContext = ThreadContext.getThreadContext();
         final MessageContext messageContext = threadContext.get(MessageContext.class);
         if (messageContext == null) {
@@ -103,7 +103,7 @@ public abstract class BaseSessionContext
     }
 
     public Object getBusinessObject(final Class interfce) {
-        check(Call.getBusinessObject);
+        doCheck(Call.getBusinessObject);
         if (interfce == null) {
             throw new IllegalStateException("Interface argument cannot me null.");
         }
@@ -162,7 +162,7 @@ public abstract class BaseSessionContext
     }
 
     public Class getInvokedBusinessInterface() {
-        check(Call.getInvokedBusinessInterface);
+        doCheck(Call.getInvokedBusinessInterface);
         final ThreadContext threadContext = ThreadContext.getThreadContext();
         final Class invokedInterface = threadContext.getInvokedInterface();
         final InterfaceType type = threadContext.getBeanContext().getInterfaceType(invokedInterface);

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java
Sat Jul  5 18:36:23 2014
@@ -42,7 +42,7 @@ public class EntityContext extends BaseC
     }
 
     public EJBLocalObject getEJBLocalObject() throws IllegalStateException {
-        check(Call.getEJBLocalObject);
+        doCheck(Call.getEJBLocalObject);
 
         final ThreadContext threadContext = ThreadContext.getThreadContext();
         final BeanContext di = threadContext.getBeanContext();
@@ -62,7 +62,7 @@ public class EntityContext extends BaseC
     }
 
     public EJBObject getEJBObject() throws IllegalStateException {
-        check(Call.getEJBObject);
+        doCheck(Call.getEJBObject);
 
         final ThreadContext threadContext = ThreadContext.getThreadContext();
         final BeanContext di = threadContext.getBeanContext();
@@ -81,13 +81,13 @@ public class EntityContext extends BaseC
     }
 
     public Object getPrimaryKey() throws IllegalStateException {
-        check(Call.getPrimaryKey);
+        doCheck(Call.getPrimaryKey);
         final ThreadContext threadContext = ThreadContext.getThreadContext();
         return threadContext.getPrimaryKey();
     }
 
-    public void check(final Call call) {
-        final Operation operation = ThreadContext.getThreadContext().getCurrentOperation();
+    public void check(final ThreadContext context, final Call call) {
+        final Operation operation = context.getCurrentOperation();
         switch (call) {
             case getUserTransaction:
             case getContextData:

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java
Sat Jul  5 18:36:23 2014
@@ -26,17 +26,13 @@ import org.apache.openejb.OpenEJBExcepti
 import org.apache.openejb.OpenEJBRuntimeException;
 import org.apache.openejb.ProxyInfo;
 import org.apache.openejb.SystemException;
-import org.apache.openejb.async.AsynchronousPool;
 import org.apache.openejb.core.ServerFederation;
-import org.apache.openejb.core.ThreadContext;
 import org.apache.openejb.core.entity.EntityEjbHomeHandler;
 import org.apache.openejb.core.managed.ManagedHomeHandler;
 import org.apache.openejb.core.singleton.SingletonEjbHomeHandler;
 import org.apache.openejb.core.stateful.StatefulEjbHomeHandler;
 import org.apache.openejb.core.stateless.StatelessEjbHomeHandler;
-import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.spi.ApplicationServer;
-import org.apache.openejb.spi.SecurityService;
 import org.apache.openejb.threads.task.CUCallable;
 import org.apache.openejb.util.LogCategory;
 import org.apache.openejb.util.Logger;
@@ -310,31 +306,20 @@ public abstract class EjbHomeProxyHandle
         final BeanContext beanContext = getBeanContext();
 
         if (beanContext.isAsynchronous(method)) {
-
-            final SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
-            Object stateTmp = securityService.currentState();
-            final boolean associate;
-            if (stateTmp == null) {
-                stateTmp = ClientSecurity.getIdentity();
-                associate = stateTmp != null;
-            } else {
-                associate = false;
-            }
-            final Object securityState = stateTmp;
-            final ThreadContext currentCtx = ThreadContext.getThreadContext();
-            final AsynchronousPool asynchronousPool = beanContext.getModuleContext().getAppContext().getAsynchronousPool();
-
-            return asynchronousPool.invoke(new CUCallable<Object>(new Callable<Object>()
{
-                @Override
-                public Object call() throws Exception {
-                    try {
-                        return homeMethodInvoke(interfce, method, args);
-                    } catch (final ApplicationException ae) {
-                        logger.error("EjbHomeProxyHandler: Asynchronous call to '" + interfce.getSimpleName()
+ "' on '" + method.getName() + "' failed", ae);
-                        throw ae;
-                    }
-                }
-            }), method.getReturnType() == Void.TYPE);
+            return beanContext.getModuleContext()
+                    .getAppContext()
+                    .getAsynchronousPool()
+                    .invoke(new CUCallable<Object>(new Callable<Object>() {
+                        @Override
+                        public Object call() throws Exception {
+                            try {
+                                return homeMethodInvoke(interfce, method, args);
+                            } catch (final ApplicationException ae) {
+                                logger.error("EjbHomeProxyHandler: Asynchronous call to '"
+ interfce.getSimpleName() + "' on '" + method.getName() + "' failed", ae);
+                                throw ae;
+                            }
+                        }
+                    }), method.getReturnType() == Void.TYPE);
         } else {
             return homeMethodInvoke(interfce, method, args);
         }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java
Sat Jul  5 18:36:23 2014
@@ -25,12 +25,8 @@ import org.apache.openejb.OpenEJBExcepti
 import org.apache.openejb.OpenEJBRuntimeException;
 import org.apache.openejb.ProxyInfo;
 import org.apache.openejb.SystemException;
-import org.apache.openejb.async.AsynchronousPool;
 import org.apache.openejb.core.ServerFederation;
-import org.apache.openejb.core.ThreadContext;
-import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.spi.ApplicationServer;
-import org.apache.openejb.spi.SecurityService;
 import org.apache.openejb.threads.task.CUCallable;
 import org.apache.openejb.util.LogCategory;
 import org.apache.openejb.util.Logger;
@@ -246,32 +242,20 @@ public abstract class EjbObjectProxyHand
         final BeanContext beanContext = getBeanContext();
 
         if (beanContext.isAsynchronous(method)) {
-
-            final SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
-            Object stateTmp = securityService.currentState();
-            final boolean associate;
-            if (stateTmp == null) {
-                stateTmp = ClientSecurity.getIdentity();
-                associate = stateTmp != null;
-            } else {
-                associate = false;
-            }
-            final Object securityState = stateTmp;
-
-            final ThreadContext threadContext = ThreadContext.getThreadContext();
-            final AsynchronousPool asynchronousPool = beanContext.getModuleContext().getAppContext().getAsynchronousPool();
-
-            return asynchronousPool.invoke(new CUCallable<Object>(new Callable<Object>()
{
-                @Override
-                public Object call() throws Exception {
-                    try {
-                        return synchronizedBusinessMethod(interfce, method, args);
-                    } catch (final ApplicationException ae) {
-                        logger.error("EjbObjectProxyHandler: Asynchronous call to '" + interfce.getSimpleName()
+ "' on '" + method.getName() + "' failed", ae);
-                        throw ae;
-                    }
-                }
-            }), method.getReturnType() == Void.TYPE);
+            return beanContext.getModuleContext()
+                    .getAppContext()
+                    .getAsynchronousPool()
+                    .invoke(new CUCallable<Object>(new Callable<Object>() {
+                        @Override
+                        public Object call() throws Exception {
+                            try {
+                                return synchronizedBusinessMethod(interfce, method, args);
+                            } catch (final ApplicationException ae) {
+                                logger.error("EjbObjectProxyHandler: Asynchronous call to
'" + interfce.getSimpleName() + "' on '" + method.getName() + "' failed", ae);
+                                throw ae;
+                            }
+                        }
+                    }), method.getReturnType() == Void.TYPE);
         } else {
             return synchronizedBusinessMethod(interfce, method, args);
         }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContext.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContext.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContext.java
Sat Jul  5 18:36:23 2014
@@ -36,13 +36,8 @@ public class ManagedContext extends Base
     }
 
     @Override
-    public void check(final Call call) {
-        final ThreadContext threadContext = ThreadContext.getThreadContext();
-        final Operation operation = threadContext.getCurrentOperation();
-        if (operation == null) {
-            return; // concurrency utilities or similar
-        }
-
+    public void check(final ThreadContext context, final Call call) {
+        final Operation operation = context.getCurrentOperation();
         switch (call) {
             case getCallerPrincipal:
             case isCallerInRole:

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContext.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContext.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContext.java
Sat Jul  5 18:36:23 2014
@@ -46,8 +46,8 @@ public class MdbContext extends BaseCont
     }
 
     @Override
-    public void check(final Call call) {
-        final Operation operation = ThreadContext.getThreadContext().getCurrentOperation();
+    public void check(final ThreadContext context, final Call call) {
+        final Operation operation = context.getCurrentOperation();
 
         switch (call) {
             case getUserTransaction:

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java
Sat Jul  5 18:36:23 2014
@@ -367,7 +367,7 @@ public abstract class AbstractSecuritySe
     public static final class ProvidedSecurityContext {
         public final SecurityContext context;
 
-        public ProvidedSecurityContext(SecurityContext context) {
+        public ProvidedSecurityContext(final SecurityContext context) {
             this.context = context;
         }
     }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContext.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContext.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContext.java
Sat Jul  5 18:36:23 2014
@@ -32,12 +32,8 @@ public class SingletonContext extends Ba
     }
 
     @Override
-    public void check(final Call call) {
-        final Operation operation = ThreadContext.getThreadContext().getCurrentOperation();
-        if (operation == null) {
-            return; // concurrency utilities or similar
-        }
-
+    public void check(final ThreadContext context, final Call call) {
+        final Operation operation = context.getCurrentOperation();
         switch (call) {
             case getEJBLocalObject:
             case getEJBObject:

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContext.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContext.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContext.java
Sat Jul  5 18:36:23 2014
@@ -36,12 +36,8 @@ public class StatefulContext extends Bas
     }
 
     @Override
-    public void check(final Call call) {
-        final Operation operation = ThreadContext.getThreadContext().getCurrentOperation();
-        if (operation == null) {
-            return; // concurrency utilities or similar
-        }
-
+    public void check(final ThreadContext context, final Call call) {
+        final Operation operation = context.getCurrentOperation();
         switch (call) {
             case getCallerPrincipal:
             case isCallerInRole:

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContext.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContext.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContext.java
Sat Jul  5 18:36:23 2014
@@ -38,12 +38,8 @@ public class StatelessContext extends Ba
     }
 
     @Override
-    public void check(final Call call) {
-        final Operation operation = ThreadContext.getThreadContext().getCurrentOperation();
-        if (operation == null) {
-            return; // concurrency utilities or similar
-        }
-
+    public void check(final ThreadContext context, final Call call) {
+        final Operation operation = context.getCurrentOperation();
         switch (call) {
             case getEJBLocalObject:
             case getEJBObject:

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java
Sat Jul  5 18:36:23 2014
@@ -745,7 +745,7 @@ public class EjbTimerServiceImpl impleme
      */
     private void checkState() throws IllegalStateException {
         final BaseContext context = (BaseContext) deployment.get(EJBContext.class);
-        context.check(BaseContext.Call.timerMethod);
+        context.doCheck(BaseContext.Call.timerMethod);
     }
 
     /**

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java
Sat Jul  5 18:36:23 2014
@@ -99,7 +99,7 @@ public class TimerImpl implements Timer,
     private void checkState() throws IllegalStateException, NoSuchObjectLocalException {
         final BeanContext beanContext = ThreadContext.getThreadContext().getBeanContext();
         final BaseContext context = (BaseContext) beanContext.get(EJBContext.class);
-        context.check(BaseContext.Call.timerMethod);
+        context.doCheck(BaseContext.Call.timerMethod);
 
         if (timerData.isCancelled() && !timerData.isStopped()) {
             throw new NoSuchObjectLocalException("Timer has been cancelled");

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/threads/task/CUTask.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/threads/task/CUTask.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/threads/task/CUTask.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/threads/task/CUTask.java
Sat Jul  5 18:36:23 2014
@@ -75,7 +75,7 @@ public abstract class CUTask<T> extends 
         throw new OpenEJBRuntimeException(t.getMessage(), t);
     }
 
-    private static class Context {
+    public static class Context {
         /*
         private static final Class<?>[] THREAD_SCOPES = new Class<?>[] {
                 RequestScoped.class, SessionScoped.class, ConversationScoped.class
@@ -93,9 +93,9 @@ public abstract class CUTask<T> extends 
         private final CdiAppContextsService.State cdiState;
         */
 
-        private Context currentContext = null;
+        private Context currentContext;
 
-        private Context(boolean associate, final Object initialSecurityServiceState,
+        private Context(final boolean associate, final Object initialSecurityServiceState,
                         final AbstractSecurityService.SecurityContext securityContext, final
ThreadContext initialThreadContext,
                         final ClassLoader initialLoader) {
             this.associate = associate;
@@ -139,6 +139,7 @@ public abstract class CUTask<T> extends 
             final ThreadContext oldCtx;
             if (threadContext != null) {
                 final ThreadContext newContext = new ThreadContext(threadContext);
+                newContext.set(Context.class, this);
                 if (securityContext != null) {
                     newContext.set(AbstractSecurityService.ProvidedSecurityContext.class,
new AbstractSecurityService.ProvidedSecurityContext(securityContext));
                 }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/threads/task/TriggerTask.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/threads/task/TriggerTask.java?rev=1608107&r1=1608106&r2=1608107&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/threads/task/TriggerTask.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/threads/task/TriggerTask.java
Sat Jul  5 18:36:23 2014
@@ -37,12 +37,12 @@ public abstract class TriggerTask<T> ext
     protected final AtomicReference<Future<T>> futureRef;
 
     protected LastExecution lastExecution;
-    protected volatile boolean skipped = false;
+    protected volatile boolean skipped;
 
-    protected volatile boolean done = false;
+    protected volatile boolean done;
 
     private final AtomicBoolean running = new AtomicBoolean(true);
-    private volatile T result = null;
+    private volatile T result;
 
     protected TriggerTask(final Object original, final ManagedScheduledExecutorServiceImpl
es, final Trigger trigger,
                           final Date taskScheduledTime, final String id, final AtomicReference<Future<T>>
ref) {



Mime
View raw message