Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor changes of the structure of two phase operation
- Loading branch information
Showing
7 changed files
with
70 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...va/com/orientechnologies/orient/server/distributed/impl/coordinator/OResponseHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
package com.orientechnologies.orient.server.distributed.impl.coordinator; | ||
|
||
public interface OResponseHandler { | ||
ORequestContext.Status receive(ODistributedCoordinator coordinator, ORequestContext context, ONodeResponse response, | ||
ORequestContext.Status status); | ||
void receive(ODistributedCoordinator coordinator, ORequestContext context, ONodeResponse response); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...rientechnologies/orient/server/distributed/impl/coordinator/mocktx/FirstPhaseHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.orientechnologies.orient.server.distributed.impl.coordinator.mocktx; | ||
|
||
import com.orientechnologies.orient.server.distributed.impl.coordinator.*; | ||
|
||
class FirstPhaseHandler implements OResponseHandler { | ||
private OSubmitTx submitTx; | ||
private final ODistributedMember member; | ||
private boolean done; | ||
|
||
public FirstPhaseHandler(OSubmitTx submitTx, ODistributedMember member) { | ||
this.submitTx = submitTx; | ||
this.member = member; | ||
} | ||
|
||
@Override | ||
public void receive(ODistributedCoordinator coordinator1, ORequestContext context, ONodeResponse response) { | ||
if (context.getResponses().size() >= context.getQuorum() && !done) { | ||
done = true; | ||
submitTx.firstPhase = true; | ||
coordinator1.sendOperation(submitTx, new OPhase2Tx(), new SecondPhaseResponseHandler(submitTx, member)); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...ologies/orient/server/distributed/impl/coordinator/mocktx/SecondPhaseResponseHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.orientechnologies.orient.server.distributed.impl.coordinator.mocktx; | ||
|
||
import com.orientechnologies.orient.server.distributed.impl.coordinator.*; | ||
|
||
public class SecondPhaseResponseHandler implements OResponseHandler { | ||
private final OSubmitTx submitTx; | ||
private final ODistributedMember member; | ||
boolean done = false; | ||
|
||
public SecondPhaseResponseHandler(OSubmitTx submitTx, ODistributedMember member) { | ||
this.member = member; | ||
this.submitTx = submitTx; | ||
} | ||
|
||
@Override | ||
public void receive(ODistributedCoordinator coordinator, ORequestContext context1, ONodeResponse response) { | ||
if (context1.getResponses().size() >= context1.getQuorum() && !done) { | ||
done = true; | ||
submitTx.secondPhase = true; | ||
member.reply(new OSubmitResponse() { | ||
}); | ||
} | ||
} | ||
} |