@Override public ExecutorService getAsynchronousExecutor() { return super.getAsynchronousExecutor(); }
@Override protected void lockedStop() throws Exception { if (cache != null) cache.stop(); super.lockedStop(); }
/** * @see org.jboss.ejb3.EJBContainer#destroy() */ @Override public void destroy() throws Exception { this.delegate.destroy(); // let the super do the rest super.destroy(); }
/** * Determines if the specified Method is a Handle Method * @param method * @return */ protected boolean isHandleMethod(SerializableMethod method) { // Get the Method Method invokingMethod = method.toMethod(this.getClassloader()); // Use legacy return this.isHandleMethod(invokingMethod); }
/** * Determines whether the specified method is an EJB2.x Home Method * * @param method * @return */ protected boolean isHomeMethod(SerializableMethod method) { // Get the Method Method invokingMethod = method.toMethod(this.getClassloader()); // Use legacy return this.isHomeMethod(invokingMethod); }
SecurityActions.setContextClassLoader(this.getClassloader()); Method actualMethod = method.toMethod(this.getClassloader()); long hash = MethodHashing.calculateHash(actualMethod); MethodInfo info = getAdvisor().getMethodInfo(hash); if (info == null) + this.getEjbName() + " : " + method.toString() + ", probable error in virtual method registration w/ Advisor for the Container"); Class<?> invokedBusinessInterface = Class.forName(method.getActualClassName(), false, getClassloader()); if (this.isEjb2xView(invokedBusinessInterface.getName())) if (unadvisedMethod != null && isHomeMethod(unadvisedSerializableMethod)) return invokeHomeMethod(actualMethod, args); else if (unadvisedMethod != null && this.isEjbObjectMethod(unadvisedSerializableMethod)) return invokeEJBObjectMethod(session, info, args); invokedBusinessInterface, this.getAsynchronousExecutor(), this); nextInvocation.getMetaData().addMetaData(SessionSpecRemotingMetadata.TAG_SESSION_INVOCATION, SessionSpecRemotingMetadata.KEY_INVOKED_METHOD, method);
if (this.getMetaData().getBusinessLocals() != null) businessInterfaceNames.addAll(this.getMetaData().getBusinessLocals()); if (this.getMetaData().getBusinessRemotes() != null) businessInterfaceNames.addAll(this.getMetaData().getBusinessRemotes()); try businessInterface = Class.forName(businessInterfaceName, false, this.getClassloader()); verifyBusinessObjectFactory();
/** * @see org.jboss.ejb3.session.SessionSpecContainer#lockedStart() */ @Override protected void lockedStart() throws Exception { super.lockedStart(); // org.jboss.ejb3.remoting.IsLocalInterceptor requires the container to be registered with Ejb3Registry Ejb3Registry.register(this); // pass on the control to our simple singleton container this.delegate.start(); }
try declaringClass = Class.forName(declaringClassName, false, this.getClassloader()); + ClassLoader.class.getSimpleName() + " for EJB " + this.getEjbName());
/** * {@inheritDoc} * @see org.jboss.ejb3.async.spi.AsyncCancellableContext#cancel(org.jboss.ejb3.async.spi.AsyncInvocationId) */ @Override public boolean cancel(final AsyncInvocationId id) throws IllegalArgumentException { // Precondition checks if (id == null) { throw new IllegalArgumentException("ID must be specified"); } // Put a flag in the cancel map, will be cleared when the invocation passes through final AsyncInvocationMap map = this.getCurrentAsyncInvocations(); return map.put(id, true) != null; }
/** * Expose this as public so that the {@link AOPBasedInterceptorRegistry} * can get hold of the legacy AOP based {@link org.jboss.ejb3.interceptors.registry.InterceptorRegistry} */ public BeanContainer getBeanContainer() { return super.getBeanContainer(); }
public <T> T getBusinessObject(Class<T> businessInterface) throws IllegalStateException { if (businessInterface == null) throw new IllegalStateException("businessInterface is null"); return container.getBusinessObject(beanContext, businessInterface); }
public void create() throws Exception super.create();
@Override protected void lockedStart() throws Exception { try { super.lockedStart(); this.createAndStartCache(); } catch (Exception e) { try { this.lockedStop(); } catch (Exception ignore) { log.debug("Failed to cleanup after start() failure", ignore); } throw e; } }
/** * {@inheritDoc} * @see org.jboss.ejb3.context.spi.SessionContext#wasCancelCalled() */ public boolean wasCancelCalled() { // Obtain the Map of current invocations final AsyncInvocationMap map = this.getContainer().getCurrentAsyncInvocations(); // Get the current invocation in play final AsyncInvocationId id = CurrentAsyncInvocation.getCurrentAsyncInvocationId(); // No async invocation in play if (id == null) { return false; } // Obtain if the current invocation has been cancelled final Boolean wasCancelled = map.get(id); // Return return wasCancelled == null ? false : wasCancelled.booleanValue(); } }
/** * Creates a {@link SessionContainerInvocation} * @param invokedBusinessInterface * @param info * @param container Used for dispatching asynchronous invocations */ public SessionContainerInvocation(Class<?> invokedBusinessInterface, MethodInfo info, final SessionSpecContainer container) { super(info); this.invocationContext = new SessionInvocationContextAdapter(invokedBusinessInterface, this, container.getAsynchronousExecutor(), container); this.container = container; this.info = info; this.invokedBusinessInterface = invokedBusinessInterface; }
/** * @see org.jboss.ejb3.session.SessionSpecContainer#lockedStop() */ @Override protected void lockedStop() throws Exception { this.delegate.stop(); if (Ejb3Registry.hasContainer(this)) { Ejb3Registry.unregister(this); } super.lockedStop(); }
final AsyncInvocationMap currentInvocations = sessionContainer.getCurrentAsyncInvocations();
/** * {@inheritDoc} * @see org.jboss.ejb3.async.spi.AsyncEndpoint#invokeAsync(java.io.Serializable, java.lang.Class, java.lang.reflect.Method, java.lang.Object[]) */ @Override public Object invokeAsync(final Serializable session, final Class<?> invokedBusinessInterface, final Method method, final Object[] args) throws Throwable { // Get the ES final ExecutorService es = this.getAsynchronousExecutor(); // Get the Security Context final SecurityContext sc = SecurityActions.getSecurityContext(); // Make a new ID for the invocation final AsyncInvocationId id = new AsyncInvocationIdUUIDImpl(); // Submit as async final Future<?> returnValue = es.submit(new AsyncInvocationTask<Object>(session,method,args, sc, id)); // Return return returnValue; }