Search in sources :

Example 1 with StateProvider

use of org.infinispan.statetransfer.StateProvider in project infinispan by infinispan.

the class StateTransferGetListenersCommand method invokeAsync.

@Override
public CompletionStage<Collection<ClusterListenerReplicateCallable<Object, Object>>> invokeAsync(ComponentRegistry registry) throws Throwable {
    StateProvider stateProvider = registry.getStateTransferManager().getStateProvider();
    Collection<ClusterListenerReplicateCallable<Object, Object>> listeners = stateProvider.getClusterListenersToInstall();
    return CompletableFuture.completedFuture(listeners);
}
Also used : StateProvider(org.infinispan.statetransfer.StateProvider) ClusterListenerReplicateCallable(org.infinispan.notifications.cachelistener.cluster.ClusterListenerReplicateCallable)

Example 2 with StateProvider

use of org.infinispan.statetransfer.StateProvider in project infinispan by infinispan.

the class ConflictResolutionStartCommand method invokeAsync.

@Override
public CompletionStage<?> invokeAsync(ComponentRegistry registry) throws Throwable {
    StateProvider stateProvider = registry.getStateTransferManager().getStateProvider();
    stateProvider.startOutboundTransfer(origin, topologyId, segments, false);
    return CompletableFutures.completedNull();
}
Also used : StateProvider(org.infinispan.statetransfer.StateProvider)

Example 3 with StateProvider

use of org.infinispan.statetransfer.StateProvider in project infinispan by infinispan.

the class StateTransferCancelCommand method invokeAsync.

@Override
public CompletionStage<?> invokeAsync(ComponentRegistry registry) throws Throwable {
    StateProvider stateProvider = registry.getStateTransferManager().getStateProvider();
    stateProvider.cancelOutboundTransfer(origin, topologyId, segments);
    return CompletableFutures.completedNull();
}
Also used : StateProvider(org.infinispan.statetransfer.StateProvider)

Example 4 with StateProvider

use of org.infinispan.statetransfer.StateProvider in project infinispan by infinispan.

the class StateTransferStartCommand method invokeAsync.

@Override
public CompletionStage<?> invokeAsync(ComponentRegistry registry) throws Throwable {
    StateProvider stateProvider = registry.getStateTransferManager().getStateProvider();
    stateProvider.startOutboundTransfer(origin, topologyId, segments, true);
    return CompletableFutures.completedNull();
}
Also used : StateProvider(org.infinispan.statetransfer.StateProvider)

Example 5 with StateProvider

use of org.infinispan.statetransfer.StateProvider in project infinispan by infinispan.

the class AbstractClusterListenerDistAddListenerTest method waitUntilRequestingListeners.

protected void waitUntilRequestingListeners(final Cache<?, ?> cache, final CheckPoint checkPoint) {
    StateProvider sp = TestingUtil.extractComponent(cache, StateProvider.class);
    final Answer<Object> forwardedAnswer = AdditionalAnswers.delegatesTo(sp);
    StateProvider mockProvider = mock(StateProvider.class, withSettings().defaultAnswer(forwardedAnswer));
    doAnswer(invocation -> {
        // Wait for main thread to sync up
        checkPoint.trigger("pre_cluster_listeners_invoked_" + cache);
        // Now wait until main thread lets us through
        checkPoint.awaitStrict("pre_cluster_listeners_release_" + cache, 10, TimeUnit.SECONDS);
        try {
            return forwardedAnswer.answer(invocation);
        } finally {
            // Wait for main thread to sync up
            checkPoint.trigger("post_cluster_listeners_invoked_" + cache);
            // Now wait until main thread lets us through
            checkPoint.awaitStrict("post_cluster_listeners_release_" + cache, 10, TimeUnit.SECONDS);
        }
    }).when(mockProvider).getClusterListenersToInstall();
    TestingUtil.replaceComponent(cache, StateProvider.class, mockProvider, true);
}
Also used : StateProvider(org.infinispan.statetransfer.StateProvider)

Aggregations

StateProvider (org.infinispan.statetransfer.StateProvider)5 ClusterListenerReplicateCallable (org.infinispan.notifications.cachelistener.cluster.ClusterListenerReplicateCallable)1