- public static CanCommitTransactionReply fromSerializable(Object message) {
- return new CanCommitTransactionReply(((ThreePhaseCommitCohortMessages.CanCommitTransactionReply)message).getCanCommit());
- }
+ private CanCommitTransactionReply(final boolean canCommit) {
+ this.canCommit = canCommit;
+ }
+
+ public boolean getCanCommit() {
+ return canCommit;
+ }
+
+ @Override
+ public Object toSerializable() {
+ return canCommit ? YES_SERIALIZED : NO_SERIALIZED;
+ }
+
+ public static CanCommitTransactionReply fromSerializable(final Object message) {
+ ThreePhaseCommitCohortMessages.CanCommitTransactionReply serialized =
+ (ThreePhaseCommitCohortMessages.CanCommitTransactionReply) message;
+ return serialized.getCanCommit() ? YES : NO;
+ }