1 18 package org.apache.activemq.pool; 19 20 25 public class SessionKey { 26 private boolean transacted; 27 private int ackMode; 28 private int hash; 29 30 public SessionKey(boolean transacted, int ackMode) { 31 this.transacted = transacted; 32 this.ackMode = ackMode; 33 hash = ackMode; 34 if (transacted) { 35 hash = 31 * hash + 1; 36 } 37 } 38 39 public int hashCode() { 40 return hash; 41 } 42 43 public boolean equals(Object that) { 44 if (this == that) { 45 return true; 46 } 47 if (that instanceof SessionKey) { 48 return equals((SessionKey) that); 49 } 50 return false; 51 } 52 53 public boolean equals(SessionKey that) { 54 return this.transacted == that.transacted && this.ackMode == that.ackMode; 55 } 56 57 public boolean isTransacted() { 58 return transacted; 59 } 60 61 public int getAckMode() { 62 return ackMode; 63 } 64 } 65 | Popular Tags |