1 7 package org.jboss.jms.serverless; 8 9 import org.jboss.logging.Logger; 10 import org.jgroups.Address; 11 import java.io.Serializable ; 12 13 20 public class QueueReceiverAddress implements Serializable { 21 22 static final long serialVersionUID = 11480310721131223L; 23 24 private static final Logger log = Logger.getLogger(QueueReceiverAddress.class); 25 26 private Address addr; 27 private String sessionID; 28 private String queueReceiverID; 29 private boolean nextForDelivery; 30 31 public QueueReceiverAddress(Address addr, String sessionID, String queueReceiverID) { 32 33 if (addr == null) { 34 throw new NullPointerException ("null address"); 35 } 36 if (sessionID == null) { 37 throw new NullPointerException ("null session ID"); 38 } 39 if (queueReceiverID == null) { 40 throw new NullPointerException ("null queue receiver ID"); 41 } 42 43 this.addr = addr; 44 this.sessionID = sessionID; 45 this.queueReceiverID = queueReceiverID; 46 } 47 48 public Address getAddress() { 49 return addr; 50 } 51 52 public String getSessionID() { 53 return sessionID; 54 } 55 56 public String getReceiverID() { 57 return queueReceiverID; 58 } 59 60 public boolean isNextForDelivery() { 61 return nextForDelivery; 62 } 63 64 public void setNextForDelivery(boolean b) { 65 nextForDelivery = b; 66 } 67 68 public boolean equals(Object o) { 69 70 if (this == o) { 71 return true; 72 } 73 74 if (!(o instanceof QueueReceiverAddress)) { 75 return false; 76 } 77 78 QueueReceiverAddress that = (QueueReceiverAddress)o; 79 80 return 81 (addr != null && addr.equals(that.addr)) && 82 (sessionID != null && sessionID.equals(that.sessionID)) && 83 (queueReceiverID != null && queueReceiverID.equals(that.queueReceiverID)); 84 85 } 86 87 public int hashCode() { 88 89 91 return 92 (addr == null ? 0 : addr.hashCode()) + 93 (sessionID == null ? 0 : sessionID.hashCode()) + 94 (queueReceiverID == null ? 0 : queueReceiverID.hashCode()); 95 96 } 97 98 public String toString() { 99 StringBuffer sb = new StringBuffer ("QueueReceiverAddress["); 100 sb.append(addr); 101 sb.append("/sessionID="); 102 sb.append(sessionID); 103 sb.append("/receiverID="); 104 sb.append(queueReceiverID); 105 sb.append("]"); 106 return sb.toString(); 107 } 108 109 } 110 | Popular Tags |