ServiceTarget serviceTarget = context.getServiceTarget();
WorkManager wm = new NamedWorkManager(name);
final WorkManagerService wmService = new WorkManagerService(wm);
ServiceBuilder builder = serviceTarget
.addService(ConnectorServices.WORKMANAGER_SERVICE.append(name), wmService);
if (operation.get(WORKMANAGER_LONG_RUNNING).isDefined() && operation.get(WORKMANAGER_LONG_RUNNING).asBoolean()) {
builder.addDependency(ThreadsServices.EXECUTOR.append(WORKMANAGER_LONG_RUNNING).append(name), Executor.class, wmService.getExecutorLongInjector());
}
builder.addDependency(ThreadsServices.EXECUTOR.append(WORKMANAGER_SHORT_RUNNING).append(name), Executor.class, wmService.getExecutorShortInjector());
builder.addDependency(TxnServices.JBOSS_TXN_XA_TERMINATOR, JBossXATerminator.class, wmService.getXaTerminatorInjector())
.addListener(verificationHandler)
.setInitialMode(ServiceController.Mode.ON_DEMAND)
.install();
}