Search in sources :

Example 1 with Address

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());
}
Also used : Address(org.jboss.jca.core.spi.workmanager.Address) ElytronSecurityIntegration(org.jboss.as.connector.security.ElytronSecurityIntegration) CommandDispatcherTransport(org.jboss.as.connector.services.workmanager.transport.CommandDispatcherTransport) XATerminatorImpl(org.jboss.jca.core.tx.jbossts.XATerminatorImpl) BlockingExecutor(org.jboss.threads.BlockingExecutor)

Example 2 with Address

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);
        }
    }
}
Also used : Address(org.jboss.jca.core.spi.workmanager.Address) HashMap(java.util.HashMap) CommandDispatcherException(org.wildfly.clustering.dispatcher.CommandDispatcherException) CancellationException(java.util.concurrent.CancellationException) Node(org.wildfly.clustering.group.Node) CompletionException(java.util.concurrent.CompletionException) HashMap(java.util.HashMap) Map(java.util.Map) CompletionStage(java.util.concurrent.CompletionStage)

Aggregations

Address (org.jboss.jca.core.spi.workmanager.Address)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 CancellationException (java.util.concurrent.CancellationException)1 CompletionException (java.util.concurrent.CompletionException)1 CompletionStage (java.util.concurrent.CompletionStage)1 ElytronSecurityIntegration (org.jboss.as.connector.security.ElytronSecurityIntegration)1 CommandDispatcherTransport (org.jboss.as.connector.services.workmanager.transport.CommandDispatcherTransport)1 XATerminatorImpl (org.jboss.jca.core.tx.jbossts.XATerminatorImpl)1 BlockingExecutor (org.jboss.threads.BlockingExecutor)1 CommandDispatcherException (org.wildfly.clustering.dispatcher.CommandDispatcherException)1 Node (org.wildfly.clustering.group.Node)1