Search in sources :

Example 1 with CommandDispatcher

use of org.wildfly.clustering.dispatcher.CommandDispatcher in project wildfly by wildfly.

the class ConcurrentBroadcastCommandDispatcherFactory method createCommandDispatcher.

@SuppressWarnings("unchecked")
@Override
public <C> CommandDispatcher<C> createCommandDispatcher(Object id, C context) {
    CommandDispatcherFactory dispatcherFactory = this.factory;
    Function<Runnable, CommandDispatcher<?>> factory = new Function<Runnable, CommandDispatcher<?>>() {

        @Override
        public CommandDispatcher<C> apply(Runnable closeTask) {
            CommandDispatcher<C> dispatcher = dispatcherFactory.createCommandDispatcher(id, context, WildFlySecurityManager.getClassLoaderPrivileged(this.getClass()));
            return new ConcurrentCommandDispatcher<>(dispatcher, closeTask);
        }
    };
    return (CommandDispatcher<C>) this.dispatchers.apply(id, factory);
}
Also used : Function(java.util.function.Function) CommandDispatcherFactory(org.wildfly.clustering.spi.dispatcher.CommandDispatcherFactory) CommandDispatcher(org.wildfly.clustering.dispatcher.CommandDispatcher)

Aggregations

Function (java.util.function.Function)1 CommandDispatcher (org.wildfly.clustering.dispatcher.CommandDispatcher)1 CommandDispatcherFactory (org.wildfly.clustering.spi.dispatcher.CommandDispatcherFactory)1