/** * {@inheritDoc} */ public void start(final StartContext context) throws StartException { final Runnable task = new Runnable() { @Override public void run() { try { getValue().start(); context.complete(); } catch (Throwable e) { context.failed(new StartException(e)); } } }; try { executor.getValue().submit(task); } catch (RejectedExecutionException e) { task.run(); } finally { context.asynchronous(); } }
@Override public void start(final StartContext startContext) throws StartException { if (autostart) { // The start can trigger the web app context initialization which involves blocking tasks like // servlet context initialization, startup servlet initialization lifecycles and such. Hence this needs to be done asynchronously // to prevent the MSC threads from blocking startContext.asynchronous(); serverExecutor.getValue().submit(new Runnable() { @Override public void run() { try { startContext(); startContext.complete(); } catch (Throwable e) { startContext.failed(new StartException(e)); } } }); } }
protected final void cleanupStartAsync(final StartContext context, final String deploymentName, final ServiceName serviceName, final Throwable cause) { ExecutorService executorService = getLifecycleExecutorService(); Runnable r = new Runnable() { @Override public void run() { try { // TODO -- one of the 3 previous synchronous calls to this method don't had the TCCL set, // but the other two don't. I (BES 2013/10/21) intepret from that that setting the TCCL // was not necessary and in caller that had it set it was an artifact of WritableServiceBasedNamingStore.pushOwner(serviceName); unregisterAll(deploymentName); } finally { WritableServiceBasedNamingStore.popOwner(); context.failed(ConnectorLogger.ROOT_LOGGER.failedToStartRaDeployment(cause, deploymentName)); } } }; try { executorService.execute(r); } catch (RejectedExecutionException e) { r.run(); } finally { context.asynchronous(); } }
task.run(); } finally { context.asynchronous();
private void cleanupStartAsync(final StartContext context, final String deploymentName, final Throwable cause, final ServiceName duServiceName, final ClassLoader toUse) { ExecutorService executorService = getLifecycleExecutorService(); Runnable r = new Runnable() { @Override public void run() { ClassLoader old = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WritableServiceBasedNamingStore.pushOwner(duServiceName); WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(toUse); unregisterAll(deploymentName); } finally { try { context.failed(ConnectorLogger.ROOT_LOGGER.failedToStartRaDeployment(cause, deploymentName)); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(old); WritableServiceBasedNamingStore.popOwner(); } } } }; try { executorService.execute(r); } catch (RejectedExecutionException e) { r.run(); } finally { context.asynchronous(); } }
/** {@inheritDoc} */ public void start(final StartContext context) { super.start(context); if (SarLogger.ROOT_LOGGER.isTraceEnabled()) { SarLogger.ROOT_LOGGER.tracef("Starting Service: %s", context.getController().getName()); } final Runnable task = new Runnable() { @Override public void run() { try { invokeLifecycleMethod(startMethod, context); context.complete(); } catch (Throwable e) { context.failed(new StartException(SarLogger.ROOT_LOGGER.failedExecutingLegacyMethod("start()"), e)); } } }; try { executorSupplier.get().submit(task); } catch (RejectedExecutionException e) { task.run(); } finally { context.asynchronous(); } }
/** {@inheritDoc} */ public void start(final StartContext context) { super.start(context); if (SarLogger.ROOT_LOGGER.isTraceEnabled()) { SarLogger.ROOT_LOGGER.tracef("Creating Service: %s", context.getController().getName()); } final Runnable task = new Runnable() { @Override public void run() { try { injectDependencies(); invokeLifecycleMethod(createMethod, context); if (componentInstantiator != null) { managedReference = componentInstantiator.initializeInstance(mBeanInstance); } context.complete(); } catch (Throwable e) { uninjectDependencies(); context.failed(new StartException(SarLogger.ROOT_LOGGER.failedExecutingLegacyMethod("create()"), e)); } } }; try { executorSupplier.get().submit(task); } catch (RejectedExecutionException e) { task.run(); } finally { context.asynchronous(); } }
@Override public void start(final StartContext context) throws StartException { if (this.asyncStart) { Runnable task = () -> { try { this.service.start(context); context.complete(); } catch (StartException e) { context.failed(e); } catch (Throwable e) { context.failed(new StartException(e)); } }; try { this.executor.get().execute(task); } catch (RejectedExecutionException e) { task.run(); } finally { context.asynchronous(); } } else { this.service.start(context); } }
@Override public void startJobRepository(final StartContext context) throws StartException { final ExecutorService service = executor.getValue(); final Runnable task = () -> { try { // Currently in jBeret tables are created in the constructor which is why this is done asynchronously jobRepository = new JdbcRepository(dataSourceValue.getValue()); context.complete(); } catch (Exception e) { context.failed(BatchLogger.LOGGER.failedToCreateJobRepository(e, "JDBC")); } }; try { service.execute(task); } catch (RejectedExecutionException e) { task.run(); } finally { context.asynchronous(); } }
@Override public void start(final StartContext context) throws StartException { if (this.startAsynchronously) { Runnable task = () -> { try { this.service.start(context); context.complete(); } catch (StartException e) { context.failed(e); } catch (Throwable e) { context.failed(new StartException(e)); } }; try { this.executor.getValue().execute(task); } catch (RejectedExecutionException e) { task.run(); } finally { context.asynchronous(); } } else { this.service.start(context); } }
public void start(final StartContext context) throws StartException { context.asynchronous(); executorInjector.getValue().submit(new Runnable() { public void run() { try { startInternal(context); context.complete(); } catch (StartException e) { context.failed(e); } catch (Throwable e) { context.failed(new StartException(e)); } } }); }
public void start(final StartContext context) throws StartException { context.asynchronous(); executorInjector.getValue().submit(new Runnable() { public void run() { try { startInternal(context); context.complete(); } catch (StartException e) { context.failed(e); } catch (Throwable e) { context.failed(new StartException(e)); } } }); }
public void start(final StartContext context) throws StartException { context.asynchronous(); executorInjector.getValue().submit(new Runnable() { public void run() { try { startInternal(context); context.complete(); } catch (StartException e) { context.failed(e); } catch (Throwable e) { context.failed(new StartException(e)); } } }); }
public void start(final StartContext context) throws StartException { context.asynchronous(); executorInjector.getValue().submit(new Runnable() { public void run() { try { performDeployment(); context.complete(); } catch (StartException e) { context.failed(e); } catch (Throwable e) { context.failed(new StartException(e)); } } }); }
public void start(final StartContext context) throws StartException { context.asynchronous(); executorInjector.getValue().submit(new Runnable() { public void run() { try { performDeployment(); context.complete(); } catch (StartException e) { context.failed(e); } catch (Throwable e) { context.failed(new StartException(e)); } } }); }
public void start(final StartContext context) throws StartException { context.asynchronous(); executorInjector.getValue().submit(new Runnable() { public void run() { try { performDeployment(); context.complete(); } catch (StartException e) { context.failed(e); } catch (Throwable e) { context.failed(new StartException(e)); } } }); }
public synchronized void start(final StartContext context) throws StartException { try { context.execute(new Runnable() { @Override public void run() { connectionManagerRegistry.addLdapConnectionManagerService(name, LdapConnectionManagerService.this); context.complete(); } }); } finally { context.asynchronous(); } }
public synchronized void start(final StartContext context) throws StartException { try { context.execute(new Runnable() { @Override public void run() { connectionManagerRegistry.addLdapConnectionManagerService(name, LdapConnectionManagerService.this); context.complete(); } }); } finally { context.asynchronous(); } }
@Override public void start(final StartContext context) throws StartException { context.asynchronous(); context.execute(new Runnable() { public void run() { try { BaseScheduledJob.this.start(); context.complete(); } catch (Exception e) { context.failed( new StartException( e ) ); } } }); }
@Override public void start(StartContext context) throws StartException { context.asynchronous(); new Thread(() -> { try { this.extensionInstallerInjector.getValue().load("zero", new ZeroExtension()); context.complete(); } catch (Throwable e) { context.failed(new StartException(e)); } }, "ZeroBootstrapper starter").start(); }