private void activate() { ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); NamespaceContextSelector.pushCurrentSelector(this.getNamespaceContextSelector()); try { this.endpoint.activate(endpointFactory, activationSpec); } finally { NamespaceContextSelector.popCurrentSelector(); } } catch (Exception e) { throw EjbLogger.ROOT_LOGGER.failedToActivateMdb(getComponentName(), e); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } }
private void deactivate() { ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); endpoint.deactivate(endpointFactory, activationSpec); } catch (ResourceException re) { throw EjbLogger.ROOT_LOGGER.failureDuringEndpointDeactivation(this.getComponentName(), re); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } }
@Override public void stop() { ClassLoader oldTccl = SecurityActions.getContextClassLoader(); try { SecurityActions.setContextClassLoader(classLoader); endpoint.deactivate(endpointFactory, activationSpec); } catch (ResourceException re) { throw MESSAGES.failureDuringEndpointDeactivation(this.getComponentName(), re); } finally { SecurityActions.setContextClassLoader(oldTccl); } getShutDownInterceptorFactory().shutdown(); if (this.pool != null) { this.pool.stop(); } super.stop(); }
@Override public void start() { if (endpoint == null) { throw MESSAGES.endpointUnAvailable(this.getComponentName()); } getShutDownInterceptorFactory().start(); super.start(); ClassLoader oldTccl = SecurityActions.getContextClassLoader(); try { SecurityActions.setContextClassLoader(classLoader); this.endpoint.activate(endpointFactory, activationSpec); } catch (ResourceException e) { throw new RuntimeException(e); } finally { SecurityActions.setContextClassLoader(oldTccl); } if (this.pool != null) { this.pool.start(); } }