Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 18 package org.apache.activemq.command; 19 20 21 26 public class ConsumerId implements DataStructure { 27 28 public static final byte DATA_STRUCTURE_TYPE=CommandTypes.CONSUMER_ID; 29 30 protected String connectionId; 31 protected long sessionId; 32 protected long value; 33 34 protected transient int hashCode; 35 protected transient String key; 36 protected transient SessionId parentId; 37 38 public ConsumerId() { 39 } 40 41 public ConsumerId(SessionId sessionId, long consumerId) { 42 this.connectionId = sessionId.getConnectionId(); 43 this.sessionId = sessionId.getValue(); 44 this.value=consumerId; 45 } 46 47 public ConsumerId(ConsumerId id) { 48 this.connectionId = id.getConnectionId(); 49 this.sessionId = id.getSessionId(); 50 this.value=id.getValue(); 51 } 52 53 public SessionId getParentId() { 54 if( parentId == null ) { 55 parentId = new SessionId(this); 56 } 57 return parentId; 58 } 59 60 public int hashCode() { 61 if( hashCode == 0 ) { 62 hashCode = connectionId.hashCode() ^ (int)sessionId ^ (int)value; 63 } 64 return hashCode; 65 } 66 67 public boolean equals(Object o) { 68 if( this == o ) 69 return true; 70 if( o == null || o.getClass()!=ConsumerId.class ) 71 return false; 72 ConsumerId id = (ConsumerId) o; 73 return sessionId==id.sessionId 74 && value==id.value 75 && connectionId.equals(id.connectionId); 76 } 77 78 public byte getDataStructureType() { 79 return DATA_STRUCTURE_TYPE; 80 } 81 82 public String toString() { 83 if( key==null ) { 84 key = connectionId+":"+sessionId+":"+value; 85 } 86 return key; 87 } 88 89 92 public String getConnectionId() { 93 return connectionId; 94 } 95 public void setConnectionId(String connectionId) { 96 this.connectionId = connectionId; 97 } 98 99 102 public long getSessionId() { 103 return sessionId; 104 } 105 public void setSessionId(long sessionId) { 106 this.sessionId = sessionId; 107 } 108 109 110 113 public long getValue() { 114 return value; 115 } 116 public void setValue(long consumerId) { 117 this.value = consumerId; 118 } 119 120 public boolean isMarshallAware() { 121 return false; 122 } 123 } 124
| Popular Tags
|