Search in sources :

Example 1 with GlobalSession

use of org.neo4j.causalclustering.core.replication.session.GlobalSession in project neo4j by neo4j.

the class DistributedOperation method deserialize.

public static DistributedOperation deserialize(ReadableChannel channel) throws IOException, EndOfStreamException {
    long mostSigBits = channel.getLong();
    long leastSigBits = channel.getLong();
    MemberId owner = new MemberId.Marshal().unmarshal(channel);
    GlobalSession globalSession = new GlobalSession(new UUID(mostSigBits, leastSigBits), owner);
    long localSessionId = channel.getLong();
    long sequenceNumber = channel.getLong();
    LocalOperationId localOperationId = new LocalOperationId(localSessionId, sequenceNumber);
    ReplicatedContent content = new CoreReplicatedContentMarshal().unmarshal(channel);
    return new DistributedOperation(content, globalSession, localOperationId);
}
Also used : MemberId(org.neo4j.causalclustering.identity.MemberId) CoreReplicatedContentMarshal(org.neo4j.causalclustering.messaging.CoreReplicatedContentMarshal) GlobalSession(org.neo4j.causalclustering.core.replication.session.GlobalSession) LocalOperationId(org.neo4j.causalclustering.core.replication.session.LocalOperationId) UUID(java.util.UUID)

Example 2 with GlobalSession

use of org.neo4j.causalclustering.core.replication.session.GlobalSession in project neo4j by neo4j.

the class ProgressTrackerImplTest method shouldIgnoreOtherSessions.

@Test
public void shouldIgnoreOtherSessions() throws Exception {
    // given
    GlobalSession sessionB = new GlobalSession(UUID.randomUUID(), null);
    DistributedOperation aliasUnderSessionB = new DistributedOperation(ReplicatedInteger.valueOf(0), sessionB, new LocalOperationId(/* same id/sequence number as operationA */
    operationA.operationId().localSessionId(), operationA.operationId().sequenceNumber()));
    Progress progressA = tracker.start(operationA);
    // when
    tracker.trackReplication(aliasUnderSessionB);
    tracker.trackResult(aliasUnderSessionB, Result.of("result"));
    // then
    assertEquals(false, progressA.isReplicated());
    assertEquals(false, progressA.futureResult().isDone());
}
Also used : GlobalSession(org.neo4j.causalclustering.core.replication.session.GlobalSession) LocalOperationId(org.neo4j.causalclustering.core.replication.session.LocalOperationId) Test(org.junit.Test)

Aggregations

GlobalSession (org.neo4j.causalclustering.core.replication.session.GlobalSession)2 LocalOperationId (org.neo4j.causalclustering.core.replication.session.LocalOperationId)2 UUID (java.util.UUID)1 Test (org.junit.Test)1 MemberId (org.neo4j.causalclustering.identity.MemberId)1 CoreReplicatedContentMarshal (org.neo4j.causalclustering.messaging.CoreReplicatedContentMarshal)1