use of org.jboss.jca.core.spi.workmanager.Address in project wildfly by wildfly.
the class DistributedWorkManagerService method start.
@Override
public void start(StartContext context) throws StartException {
ROOT_LOGGER.debugf("Starting Jakarta Connectors DistributedWorkManager: ", value.getName());
CommandDispatcherTransport transport = new CommandDispatcherTransport(this.dispatcherFactory.getValue(), this.value.getName());
this.value.setTransport(transport);
BlockingExecutor longRunning = (BlockingExecutor) executorLong.getOptionalValue();
if (longRunning != null) {
this.value.setLongRunningThreadPool(longRunning);
this.value.setShortRunningThreadPool(new StatisticsExecutorImpl((BlockingExecutor) executorShort.getValue()));
} else {
this.value.setLongRunningThreadPool(new StatisticsExecutorImpl((BlockingExecutor) executorShort.getValue()));
this.value.setShortRunningThreadPool(new StatisticsExecutorImpl((BlockingExecutor) executorShort.getValue()));
}
this.value.setXATerminator(new XATerminatorImpl(xaTerminator.getValue()));
this.value.setSecurityIntegration(new ElytronSecurityIntegration());
try {
transport.startup();
} catch (Throwable throwable) {
ROOT_LOGGER.trace("failed to start DWM transport:", throwable);
throw ROOT_LOGGER.failedToStartDWMTransport(this.value.getName());
}
transport.register(new Address(value.getId(), value.getName(), transport.getId()));
WorkManagerCoordinator.getInstance().registerWorkManager(value);
ROOT_LOGGER.debugf("Started Jakarta Connectors DistributedWorkManager: ", value.getName());
}
use of org.jboss.jca.core.spi.workmanager.Address in project wildfly by wildfly.
the class CommandDispatcherTransport method join.
private void join(Membership membership) {
Map<Node, CompletionStage<Set<Address>>> futures = new HashMap<>();
for (Node member : membership.getMembers()) {
if (!this.getOwnAddress().equals(member) && !this.nodes.containsValue(member)) {
try {
futures.put(member, this.dispatcher.executeOnMember(new GetWorkManagersCommand(), member));
} catch (CommandDispatcherException e) {
ConnectorLogger.ROOT_LOGGER.warn(e.getLocalizedMessage(), e);
}
}
}
for (Map.Entry<Node, CompletionStage<Set<Address>>> entry : futures.entrySet()) {
Node member = entry.getKey();
try {
Set<Address> addresses = entry.getValue().toCompletableFuture().join();
for (Address address : addresses) {
this.join(address, member);
this.localUpdateLongRunningFree(address, this.getShortRunningFree(address));
this.localUpdateShortRunningFree(address, this.getShortRunningFree(address));
}
} catch (CancellationException e) {
// Ignore
} catch (CompletionException e) {
ConnectorLogger.ROOT_LOGGER.warn(e.getLocalizedMessage(), e);
}
}
}
Aggregations