1 package org.objectweb.perseus.concurrency.distributed.globallock.lib; 2 3 26 27 28 import java.io.Serializable ; 29 30 33 34 public class GlobalLockMessage implements Serializable { 35 36 static final byte UPGRADE_REQUEST = 0; 38 static final byte DOWNGRADE_NOTIFY = 1; 39 static final byte UPGRADE_CANCEL = 2; 40 41 static final byte UPGRADE_NOTIFY = 2; 43 static final byte DOWNGRADE_REQUEST = 3; 44 46 byte type; 47 byte lck; 48 long timeout; 49 Object requester; int serialNumber; 51 53 GlobalLockMessage(byte type, byte lck, long timeout, Object requester, 54 int serialNumber) { 55 this(type, lck, timeout, requester); 56 this.serialNumber = serialNumber; 57 } 58 59 GlobalLockMessage(byte type, byte lck, long timeout, Object requester) { 60 this.type = type; 61 this.lck = lck; 62 this.timeout = timeout; 63 this.requester = requester; 64 } 66 67 77 private static String typeToString(byte type) { 78 switch (type) { 79 case UPGRADE_NOTIFY: return "UPGRADE_NOTIFY"; 80 case UPGRADE_REQUEST: return "UPGRADE_REQUEST"; 81 case DOWNGRADE_NOTIFY: return "DOWNGRADE_NOTIFY"; 82 case DOWNGRADE_REQUEST: return "DOWNGRADE_REQUEST"; 83 } 84 return ""; 85 } 86 87 public String toString() { 88 return "Dist RWLockValue Message (" + typeToString(type) + 89 ", lck=" + lck + ", req=" + requester + ", SN=" 90 + serialNumber + ")"; 91 } 92 93 } 94 | Popular Tags |