1 3 package org.jgroups; 4 5 6 7 11 public class Event { 12 public static final int MSG = 1; public static final int CONNECT = 2; public static final int CONNECT_OK = 3; public static final int DISCONNECT = 4; public static final int DISCONNECT_OK = 5; 17 public static final int VIEW_CHANGE = 6; public static final int GET_LOCAL_ADDRESS = 7; 19 public static final int SET_LOCAL_ADDRESS = 8; 20 public static final int SUSPECT = 9; public static final int BLOCK = 10; 22 public static final int BLOCK_OK = 11; 23 public static final int FIND_INITIAL_MBRS = 12; 24 public static final int FIND_INITIAL_MBRS_OK = 13; public static final int MERGE = 14; public static final int TMP_VIEW = 15; public static final int BECOME_SERVER = 16; public static final int GET_APPLSTATE = 17; public static final int GET_APPLSTATE_OK = 18; public static final int GET_STATE = 19; public static final int GET_STATE_OK = 20; public static final int STATE_RECEIVED = 21; public static final int START_QUEUEING = 22; 34 public static final int STOP_QUEUEING = 23; public static final int SWITCH_NAK = 24; 36 public static final int SWITCH_NAK_ACK = 25; 37 public static final int SWITCH_OUT_OF_BAND = 26; 38 public static final int FLUSH = 27; public static final int FLUSH_OK = 28; public static final int DROP_NEXT_MSG = 29; 41 public static final int STABLE = 30; public static final int GET_MSG_DIGEST = 31; public static final int GET_MSG_DIGEST_OK = 32; public static final int REBROADCAST_MSGS = 33; public static final int REBROADCAST_MSGS_OK = 34; 46 public static final int GET_MSGS_RECEIVED = 35; 47 public static final int GET_MSGS_RECEIVED_OK = 36; public static final int GET_MSGS = 37; public static final int GET_MSGS_OK = 38; public static final int GET_DIGEST = 39; public static final int GET_DIGEST_OK = 40; public static final int SET_DIGEST = 41; public static final int GET_DIGEST_STATE = 42; public static final int GET_DIGEST_STATE_OK = 43; public static final int SET_PARTITIONS = 44; public static final int MERGE_DENIED = 45; public static final int EXIT = 46; public static final int PERF = 47; public static final int SUBVIEW_MERGE = 48; public static final int SUBVIEWSET_MERGE = 49; public static final int HEARD_FROM = 50; public static final int UNSUSPECT = 51; public static final int SET_PID = 52; public static final int MERGE_DIGEST = 53; public static final int BLOCK_SEND = 54; public static final int UNBLOCK_SEND = 55; public static final int CONFIG = 56; public static final int GET_DIGEST_STABLE = 57; 69 public static final int GET_DIGEST_STABLE_OK = 58; public static final int START = 61; public static final int START_OK = 62; public static final int STOP = 63; public static final int STOP_OK = 64; public static final int SUSPEND_STABLE = 65; public static final int RESUME_STABLE = 66; 79 80 81 public static final int USER_DEFINED=1000; 83 84 private int type; private Object arg; 87 88 public Event(int type) { 89 this.type=type; 90 } 91 92 public Event(int type, Object arg) { 93 this.type=type; 94 this.arg=arg; 95 } 96 97 public int getType() { 98 return type; 99 } 100 101 public void setType(int type) { 102 this.type=type; 103 } 104 105 public Object getArg() { 106 return arg; 107 } 108 109 public void setArg(Object arg) { 110 this.arg=arg; 111 } 112 113 114 115 public static String type2String(int t) { 116 switch(t) { 117 case MSG: return "MSG"; 118 case CONNECT: return "CONNECT"; 119 case CONNECT_OK: return "CONNECT_OK"; 120 case DISCONNECT: return "DISCONNECT"; 121 case DISCONNECT_OK: return "DISCONNECT_OK"; 122 case VIEW_CHANGE: return "VIEW_CHANGE"; 123 case GET_LOCAL_ADDRESS: return "GET_LOCAL_ADDRESS"; 124 case SET_LOCAL_ADDRESS: return "SET_LOCAL_ADDRESS"; 125 case SUSPECT: return "SUSPECT"; 126 case BLOCK: return "BLOCK"; 127 case BLOCK_OK: return "BLOCK_OK"; 128 case FIND_INITIAL_MBRS: return "FIND_INITIAL_MBRS"; 129 case FIND_INITIAL_MBRS_OK: return "FIND_INITIAL_MBRS_OK"; 130 case TMP_VIEW: return "TMP_VIEW"; 131 case BECOME_SERVER: return "BECOME_SERVER"; 132 case GET_APPLSTATE: return "GET_APPLSTATE"; 133 case GET_APPLSTATE_OK: return "GET_APPLSTATE_OK"; 134 case GET_STATE: return "GET_STATE"; 135 case GET_STATE_OK: return "GET_STATE_OK"; 136 case STATE_RECEIVED: return "STATE_RECEIVED"; 137 case START_QUEUEING: return "START_QUEUEING"; 138 case STOP_QUEUEING: return "STOP_QUEUEING"; 139 case SWITCH_NAK: return "SWITCH_NAK"; 140 case SWITCH_NAK_ACK: return "SWITCH_NAK_ACK"; 141 case SWITCH_OUT_OF_BAND: return "SWITCH_OUT_OF_BAND"; 142 case FLUSH: return "FLUSH"; 143 case FLUSH_OK: return "FLUSH_OK"; 144 case DROP_NEXT_MSG: return "DROP_NEXT_MSG"; 145 case STABLE: return "STABLE"; 146 case GET_MSG_DIGEST: return "GET_MSG_DIGEST"; 147 case GET_MSG_DIGEST_OK: return "GET_MSG_DIGEST_OK"; 148 case REBROADCAST_MSGS: return "REBROADCAST_MSGS"; 149 case REBROADCAST_MSGS_OK: return "REBROADCAST_MSGS_OK"; 150 case GET_MSGS_RECEIVED: return "GET_MSGS_RECEIVED"; 151 case GET_MSGS_RECEIVED_OK: return "GET_MSGS_RECEIVED_OK"; 152 case GET_MSGS: return "GET_MSGS"; 153 case GET_MSGS_OK: return "GET_MSGS_OK"; 154 case GET_DIGEST: return "GET_DIGEST"; 155 case GET_DIGEST_OK: return "GET_DIGEST_OK"; 156 case SET_DIGEST: return "SET_DIGEST"; 157 case GET_DIGEST_STATE: return "GET_DIGEST_STATE"; 158 case GET_DIGEST_STATE_OK: return "GET_DIGEST_STATE_OK"; 159 case SET_PARTITIONS: return "SET_PARTITIONS"; case MERGE: return "MERGE"; case MERGE_DENIED: return "MERGE_DENIED"; case EXIT: return "EXIT"; 163 case PERF: return "PERF"; 164 case SUBVIEW_MERGE: return "SUBVIEW_MERGE"; 165 case SUBVIEWSET_MERGE: return "SUBVIEWSET_MERGE"; 166 case HEARD_FROM: return "HEARD_FROM"; 167 case UNSUSPECT: return "UNSUSPECT"; 168 case SET_PID: return "SET_PID"; 169 case MERGE_DIGEST: return "MERGE_DIGEST"; 170 case BLOCK_SEND: return "BLOCK_SEND"; 171 case UNBLOCK_SEND: return "UNBLOCK_SEND"; 172 case CONFIG: return "CONFIG"; 173 case GET_DIGEST_STABLE: return "GET_DIGEST_STABLE"; 174 case GET_DIGEST_STABLE_OK: return "GET_DIGEST_STABLE_OK"; 175 case START: return "START"; 178 case START_OK: return "START_OK"; 179 case STOP: return "STOP"; 180 case STOP_OK: return "STOP_OK"; 181 case SUSPEND_STABLE: return "SUSPEND_STABLE"; 182 case RESUME_STABLE: return "RESUME_STABLE"; 183 184 case USER_DEFINED: return "USER_DEFINED"; 185 default: return "UNDEFINED"; 186 } 187 } 188 189 public static final Event FIND_INITIAL_MBRS_EVT = new Event(Event.FIND_INITIAL_MBRS); 190 public static final Event GET_DIGEST_EVT = new Event(Event.GET_DIGEST); 191 192 public String toString() { 193 StringBuffer ret=new StringBuffer (64); 194 ret.append("Event[type=" + type2String(type) + ", arg=" + arg + ']'); 195 return ret.toString(); 196 } 197 198 } 199 200 | Popular Tags |