Package org.wildfly.clustering.dispatcher

Examples of org.wildfly.clustering.dispatcher.CommandDispatcherFactory


        String name = "cache";
        String evictedSessionId = "evicted";
        String activeSessionId = "active";
        ImmutableSession evictedSession = mock(ImmutableSession.class);
        ImmutableSession activeSession = mock(ImmutableSession.class);
        CommandDispatcherFactory dispatcherFactory = mock(CommandDispatcherFactory.class);
        CommandDispatcher<SessionEvictionContext> dispatcher = mock(CommandDispatcher.class);
        Batcher<TransactionBatch> batcher = mock(Batcher.class);
        TransactionBatch batch = mock(TransactionBatch.class);
        Evictor<String> evictor = mock(Evictor.class);
        ArgumentCaptor<Command> capturedCommand = ArgumentCaptor.forClass(Command.class);
        ArgumentCaptor<SessionEvictionContext> capturedContext = ArgumentCaptor.forClass(SessionEvictionContext.class);

        when(dispatcherFactory.createCommandDispatcher(same(name), capturedContext.capture())).thenReturn(dispatcher);

        try (Scheduler scheduler = new SessionEvictionScheduler(name, batcher, evictor, dispatcherFactory, 1)) {
            SessionEvictionContext context = capturedContext.getValue();
           
            assertSame(scheduler, context);
View Full Code Here


    @Override
    public <L> SessionManager<L, TransactionBatch> createSessionManager(final SessionContext context, IdentifierFactory<String> identifierFactory, LocalContextFactory<L> localContextFactory) {
        final Batcher<TransactionBatch> batcher = new InfinispanBatcher(this.cache.getValue());
        final IdentifierFactory<String> factory = new AffinityIdentifierFactory<>(identifierFactory, this.cache.getValue(), this.affinityFactory.getValue());
        final Cache<String, ?> cache = this.cache.getValue();
        final CommandDispatcherFactory dispatcherFactory = this.dispatcherFactory.getValue();
        final NodeFactory<Address> nodeFactory = this.nodeFactory.getValue();
        final int maxActiveSessions = this.config.getMaxActiveSessions();
        InfinispanSessionManagerConfiguration config = new InfinispanSessionManagerConfiguration() {
            @Override
            public SessionContext getSessionContext() {
View Full Code Here

        BeanFactory<G, I, T> beanFactory = new InfinispanBeanFactory<>(beanName, groupFactory, beanCache, this.context.getTimeout(), persistent ? passivationListener : null);
        Configuration<I, BeanKey<I>, BeanEntry<G>, BeanFactory<G, I, T>> beanConfiguration = new SimpleConfiguration<>(beanCache, beanFactory, beanIdentifierFactory);
        final NodeFactory<Address> nodeFactory = this.nodeFactory.getValue();
        final Registry<String, ?> registry = this.registry.getValue();
        final KeyAffinityServiceFactory affinityFactory = this.affinityFactory.getValue();
        final CommandDispatcherFactory dispatcherFactory = this.dispatcherFactory.getValue();
        final Time timeout = this.context.getTimeout();
        final ScheduledExecutorService scheduler = this.scheduler.getValue();
        final ExpirationConfiguration<T> expiration = new ExpirationConfiguration<T>() {
            @Override
            public Time getTimeout() {
View Full Code Here

    @Test
    public void test() throws Exception {
        String name = "bean";
        String evictedBeanId = "evicted";
        String activeBeanId = "active";
        CommandDispatcherFactory dispatcherFactory = mock(CommandDispatcherFactory.class);
        CommandDispatcher<BeanEvictionContext<String>> dispatcher = mock(CommandDispatcher.class);
        Batcher<TransactionBatch> batcher = mock(Batcher.class);
        TransactionBatch batch = mock(TransactionBatch.class);
        Evictor<String> evictor = mock(Evictor.class);
        PassivationConfiguration<Bean<Object, String, Object>> config = mock(PassivationConfiguration.class);
        BeanPassivationConfiguration passivationConfig = mock(BeanPassivationConfiguration.class);
        ArgumentCaptor<Command> capturedCommand = ArgumentCaptor.forClass(Command.class);
        ArgumentCaptor<BeanEvictionContext> capturedContext = ArgumentCaptor.forClass(BeanEvictionContext.class);

        when(dispatcherFactory.createCommandDispatcher(same(name), (BeanEvictionContext<String>) capturedContext.capture())).thenReturn(dispatcher);
        when(config.getConfiguration()).thenReturn(passivationConfig);
        when(passivationConfig.getMaxSize()).thenReturn(1);

        try (Scheduler<String> scheduler = new BeanEvictionScheduler<>(name, batcher, evictor, dispatcherFactory, config)) {
            BeanEvictionContext<String> context = capturedContext.getValue();
View Full Code Here

TOP

Related Classes of org.wildfly.clustering.dispatcher.CommandDispatcherFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.