X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fcds-access-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Faccess%2Fcommands%2FPersistenceProtocol.java;h=be58b05b1fc87f3f3cdceb6f9ef6271dd210fbd8;hb=abaef4a5ae37f27542155457fe7306a4662b1eeb;hp=36acfb2925a66aa932812a43cc0fdc96dbff7e63;hpb=e4a1f1fa1f3efb4442c1141224b8a2df714efcb4;p=controller.git diff --git a/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/PersistenceProtocol.java b/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/PersistenceProtocol.java index 36acfb2925..be58b05b1f 100644 --- a/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/PersistenceProtocol.java +++ b/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/PersistenceProtocol.java @@ -33,7 +33,7 @@ public enum PersistenceProtocol implements WritableObject { }, /** * Simple commit protocol. The transaction should be committed to the global history. The receiving backend - * it the only entity which needs to persist its effects, hence a simple request/reply protocol is sufficient. + * is the only entity which needs to persist its effects, hence a simple request/reply protocol is sufficient. */ SIMPLE { @Override @@ -50,7 +50,16 @@ public enum PersistenceProtocol implements WritableObject { byte byteValue() { return 3; } - + }, + /** + * Transaction is ready. This is not a really a persistence protocol, but an indication that frontend has + * completed modifications on the transaction and considers it ready, without deciding the actual commit protocol. + */ + READY { + @Override + byte byteValue() { + return 4; + } }; @Override @@ -58,18 +67,18 @@ public enum PersistenceProtocol implements WritableObject { out.writeByte(byteValue()); } - abstract byte byteValue(); - public static PersistenceProtocol readFrom(final DataInput in) throws IOException { return valueOf(in.readByte()); } + abstract byte byteValue(); + static int byteValue(final PersistenceProtocol finish) { return finish == null ? 0 : finish.byteValue(); } - static PersistenceProtocol valueOf(final byte b) { - switch (b) { + static PersistenceProtocol valueOf(final byte value) { + switch (value) { case 0: return null; case 1: @@ -78,8 +87,10 @@ public enum PersistenceProtocol implements WritableObject { return SIMPLE; case 3: return THREE_PHASE; + case 4: + return READY; default: - throw new IllegalArgumentException("Unhandled byte value " + b); + throw new IllegalArgumentException("Unhandled byte value " + value); } } }