1 45 package org.exolab.jms.net.socket; 46 47 import org.exolab.jms.net.connector.URIRequestInfo; 48 import org.exolab.jms.net.connector.ResourceException; 49 import org.exolab.jms.net.uri.URI; 50 import org.exolab.jms.net.util.Properties; 51 52 53 61 public class SocketRequestInfo extends URIRequestInfo { 62 63 67 private URI _alternativeURI = null; 68 69 74 private int _connectionRequestQueueSize = 50; 75 76 82 private boolean _bindAll = true; 83 84 87 private int _maxThreads = 10; 88 89 93 private static final String ALTERNATIVE_URI = "alternativeURI"; 94 95 99 private static final String BIND_ALL = "bindAll"; 100 101 104 private static final String MAX_THREADS = "maxThreads"; 105 106 107 112 public SocketRequestInfo(URI uri) { 113 super(uri); 114 } 115 116 123 public SocketRequestInfo(URI uri, Properties properties) 124 throws ResourceException { 125 super(uri); 126 setAlternativeURI(properties.getURI(ALTERNATIVE_URI)); 127 setBindAll(properties.getBoolean(BIND_ALL, _bindAll)); 128 setMaxThreads(properties.getInt(MAX_THREADS, _maxThreads)); 129 } 130 131 140 public void setAlternativeURI(URI uri) { 141 _alternativeURI = uri; 142 } 143 144 149 public URI getAlternativeURI() { 150 return _alternativeURI; 151 } 152 153 160 public void setConnectionRequestQueueSize(int size) { 161 _connectionRequestQueueSize = size; 162 } 163 164 169 public int getConnectionRequestQueueSize() { 170 return _connectionRequestQueueSize; 171 } 172 173 180 public void setBindAll(boolean bindAll) { 181 _bindAll = bindAll; 182 } 183 184 192 public boolean getBindAll() { 193 return _bindAll; 194 } 195 196 202 public void setMaxThreads(int count) { 203 _maxThreads = count; 204 } 205 206 212 public int getMaxThreads() { 213 return _maxThreads; 214 } 215 216 221 public void export(Properties properties) { 222 super.export(properties); 223 properties.setNonNull(ALTERNATIVE_URI, getAlternativeURI()); 224 properties.set(BIND_ALL, getBindAll()); 225 properties.set(MAX_THREADS, getMaxThreads()); 226 } 227 228 235 public boolean equals(Object other) { 236 boolean equal = false; 237 if (other instanceof SocketRequestInfo && super.equals(other)) { 238 SocketRequestInfo info = (SocketRequestInfo) other; 239 if (equals(_alternativeURI, info._alternativeURI) 240 && _connectionRequestQueueSize 241 == info._connectionRequestQueueSize 242 && _bindAll == info._bindAll 243 && _maxThreads == info._maxThreads) { 244 equal = true; 245 } 246 } 247 return equal; 248 } 249 250 258 protected boolean equals(Object o1, Object o2) { 259 boolean equal = (o1 == null && o2 == null); 260 if (!equal) { 261 if (o1 != null && o1.equals(o2)) { 262 equal = true; 263 } 264 } 265 return equal; 266 } 267 268 } 269 | Popular Tags |