Changeset 59 for trunk/src/main/java/omq/client
- Timestamp:
- 06/26/13 10:01:10 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/main/java/omq/client/proxy/Proxymq.java
r58 r59 8 8 import java.util.Collection; 9 9 import java.util.HashMap; 10 import java.util.Hashtable;11 10 import java.util.Map; 12 11 import java.util.Properties; … … 25 24 import omq.common.util.ParameterQueue; 26 25 import omq.common.util.Serializer; 27 import omq.exception.NoContainsInstanceException;28 26 import omq.exception.OmqException; 29 27 import omq.exception.RetryException; … … 50 48 private static final Logger logger = Logger.getLogger(Proxymq.class.getName()); 51 49 private static final String multi = "multi#"; 52 private static Map<String, Object> proxies = new Hashtable<String, Object>();53 50 54 51 private String uid; … … 287 284 // Remove the corrId to receive new replies 288 285 resp = serializer.deserializeResponse(results.remove(corrId), actualType); 289 System.out.println("/n/n/n/n/nResult type: "+resp.getResult()+" /n/n/n/n/n");290 286 Array.set(array, i, resp.getResult()); 291 287 } … … 297 293 298 294 return array; 299 }300 301 /**302 *303 * @param reference304 * RemoteObject reference305 * @return true if the proxy has been created before or false in the other306 * case307 */308 public static boolean containsProxy(String reference) {309 return proxies.containsKey(reference);310 }311 312 /**313 *314 * @param reference315 * RemoteObject reference316 * @return a proxy instance317 * @throws NoContainsInstanceException318 */319 public static Object getInstance(String reference) throws NoContainsInstanceException {320 if (!containsProxy(reference)) {321 throw new NoContainsInstanceException(reference);322 }323 return proxies.get(reference);324 295 } 325 296 … … 341 312 */ 342 313 public static Object newProxyInstance(ClassLoader loader, Class<?>[] interfaces, Proxymq proxy) { 343 if (proxies.containsKey(proxy.getRef())) { 344 return proxies.get(proxy.getRef()); 345 } 346 Object value = Proxy.newProxyInstance(loader, interfaces, proxy); 347 proxies.put(proxy.getRef(), value); 348 return value; 314 return Proxy.newProxyInstance(loader, interfaces, proxy); 349 315 } 350 316 … … 359 325 } 360 326 361 public static void stopProxy() {362 proxies = new HashMap<String, Object>();363 }364 365 public static Map<String, Object> getProxies() {366 return proxies;367 }368 369 public static void setProxies(Map<String, Object> proxies) {370 Proxymq.proxies = proxies;371 }372 373 327 @Override 374 328 public String getRef() {
Note: See TracChangeset
for help on using the changeset viewer.