1 package org.jboss.mx.remoting.rmi; 2 3 import javax.management.ObjectName ; 4 import javax.management.NotificationListener ; 5 import javax.management.NotificationFilter ; 6 7 15 public class ClientListenerHolder 16 { 17 private ObjectName targetMBean; 18 private NotificationListener listener; 19 private NotificationFilter filter; 20 private Object handback; 21 private boolean filterOnClient = false; 22 23 public ClientListenerHolder(ObjectName objectName, NotificationListener listener, 24 NotificationFilter filter, Object handback) 25 { 26 this.targetMBean = objectName; 27 this.listener = listener; 28 this.filter = filter; 29 this.handback = handback; 30 } 31 32 35 public int hashCode() 36 { 37 int hashcode = targetMBean.hashCode() + listener.hashCode() + (filter != null ? filter.hashCode() : 0) + (handback != null ? handback.hashCode() : 0); 38 return hashcode; 39 } 40 41 44 public boolean equals(Object obj) 45 { 46 if(obj != null) 47 { 48 if(obj instanceof ClientListenerHolder) 49 { 50 ClientListenerHolder holder = (ClientListenerHolder)obj; 51 if(targetMBean.equals(holder.getObjectName()) && 52 listener.equals(holder.getListener())) 53 { 54 if(filter != null) 55 { 56 if(filter.equals(holder.getFilter())) 57 { 58 if(handback != null) 59 { 60 return handback.equals(holder.getHandback()); 61 } 62 else 63 { 64 if(holder.getHandback() == null) 65 { 66 return true; 67 } 68 else 69 { 70 return false; 71 } 72 } 73 } 74 else 75 { 76 return false; 77 } 78 } 79 else 80 { 81 if(holder.getFilter() == null) 82 { 83 if(handback != null) 84 { 85 return handback.equals(holder.getHandback()); 86 } 87 else 88 { 89 if(holder.getHandback() == null) 90 { 91 return true; 92 } 93 else 94 { 95 return false; 96 } 97 } 98 } 99 else 100 { 101 return false; 102 } 103 } 104 } 105 else 106 { 107 return false; 108 } 109 } 110 else 111 { 112 return false; 113 } 114 } 115 else 116 { 117 return false; 118 } 119 } 120 121 public NotificationListener getListener() 122 { 123 return listener; 124 } 125 126 public NotificationFilter getFilter() 127 { 128 return filter; 129 } 130 131 public Object getHandback() 132 { 133 return handback; 134 } 135 136 public ObjectName getObjectName() 137 { 138 return targetMBean; 139 } 140 141 public void setFilterOnClient(boolean shouldFilterOnClient) 142 { 143 filterOnClient = shouldFilterOnClient; 144 } 145 146 public boolean getFilterOnClient() 147 { 148 return filterOnClient; 149 } 150 } 151 | Popular Tags |