@Override public synchronized void stop(final StopContext context) { this.context = null; DefaultEJBClientContextSelector.INSTANCE.destroy(); }
@Override public synchronized void start(final StartContext context) throws StartException { final EJBClientContext clientContext = EJBClientContext.create(new LocalOnlyEjbClientConfiguration()); // register the default local EJB receiver (if present - app clients don't have local EJB receivers) final LocalEjbReceiver localEjbReceiver = this.defaultLocalEJBReceiver.getOptionalValue(); if (localEjbReceiver != null) { clientContext.registerEJBReceiver(localEjbReceiver); } this.context = clientContext; if (this.lockSelectorOnStart) { // lock the EJB client context selector AccessController.doPrivileged(new LockSelectorAction()); } // the EJBClientContext selector is set to DefaultEJBClientContextSelector and is *locked* once // (in a static block of this service) so that restarting this service will not cause failures related // to resetting the selector. The DefaultEJBClientContextSelector is backed by a TCCLEJBClientContextSelectorService // which is what we set here during the service start, so that the selector has the correct service to return the // EJBClientContext. @see https://issues.jboss.org/browse/AS7-2998 for details DefaultEJBClientContextSelector.INSTANCE.setup(this.tcclEJBClientContextSelector.getValue(), this.context); }