Search in sources :

Example 1 with SimulatedActionConsumer

use of org.apache.cassandra.simulator.systems.SimulatedActionConsumer in project cassandra by apache.

the class OnClusterLeave method performSimple.

public ActionList performSimple() {
    IInvokableInstance leaveInstance = actions.cluster.get(leaving);
    before(leaveInstance);
    AtomicReference<Supplier<? extends Future<?>>> preparedUnbootstrap = new AtomicReference<>();
    return ActionList.of(// setup the node's own gossip state for pending ownership, and return gossip actions to disseminate
    new OnClusterUpdateGossip(actions, leaving, new OnInstanceSetLeaving(actions, leaving)), new SimulatedActionConsumer<>("Prepare unbootstrap on " + leaving, RELIABLE_NO_TIMEOUTS, RELIABLE_NO_TIMEOUTS, actions, leaveInstance, ref -> ref.set(StorageService.instance.prepareUnbootstrapStreaming()), preparedUnbootstrap), new SimulatedActionConsumer<>("Execute unbootstrap on " + leaving, RELIABLE_NO_TIMEOUTS, RELIABLE_NO_TIMEOUTS, actions, leaveInstance, ref -> FBUtilities.waitOnFuture(ref.get().get()), preparedUnbootstrap), // setup the node's own gossip state for natural ownership, and return gossip actions to disseminate
    new OnClusterUpdateGossip(actions, leaving, new OnInstanceSetLeft(actions, leaving)));
}
Also used : SimulatedActionConsumer(org.apache.cassandra.simulator.systems.SimulatedActionConsumer) RELIABLE_NO_TIMEOUTS(org.apache.cassandra.simulator.Action.Modifiers.RELIABLE_NO_TIMEOUTS) FBUtilities(org.apache.cassandra.utils.FBUtilities) LazyToString.lazy(org.apache.cassandra.utils.LazyToString.lazy) IInvokableInstance(org.apache.cassandra.distributed.api.IInvokableInstance) Future(org.apache.cassandra.utils.concurrent.Future) StorageService(org.apache.cassandra.service.StorageService) ActionList(org.apache.cassandra.simulator.ActionList) AtomicReference(java.util.concurrent.atomic.AtomicReference) Supplier(java.util.function.Supplier) IInvokableInstance(org.apache.cassandra.distributed.api.IInvokableInstance) Future(org.apache.cassandra.utils.concurrent.Future) Supplier(java.util.function.Supplier) AtomicReference(java.util.concurrent.atomic.AtomicReference)

Aggregations

AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Supplier (java.util.function.Supplier)1 IInvokableInstance (org.apache.cassandra.distributed.api.IInvokableInstance)1 StorageService (org.apache.cassandra.service.StorageService)1 RELIABLE_NO_TIMEOUTS (org.apache.cassandra.simulator.Action.Modifiers.RELIABLE_NO_TIMEOUTS)1 ActionList (org.apache.cassandra.simulator.ActionList)1 SimulatedActionConsumer (org.apache.cassandra.simulator.systems.SimulatedActionConsumer)1 FBUtilities (org.apache.cassandra.utils.FBUtilities)1 LazyToString.lazy (org.apache.cassandra.utils.LazyToString.lazy)1 Future (org.apache.cassandra.utils.concurrent.Future)1