Changeset 59 for trunk/src/main/java/omq/common/broker/Broker.java
- Timestamp:
- 06/26/13 10:01:10 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/main/java/omq/common/broker/Broker.java
r54 r59 4 4 import java.net.URL; 5 5 import java.util.HashMap; 6 import java.util.Hashtable; 6 7 import java.util.Map; 7 8 import java.util.Properties; … … 44 45 private Properties environment = null; 45 46 private Map<String, RemoteObject> remoteObjs; 47 private Map<String, Object> proxies = new Hashtable<String, Object>(); 46 48 47 49 public Broker(Properties env) throws Exception { … … 71 73 responseListener.kill(); 72 74 eventDispatcher.kill(); 73 Proxymq.stopProxy();75 //TODO proxies = null; ?? 74 76 } 75 77 // Stop all the remote objects working … … 123 125 124 126 @SuppressWarnings("unchecked") 125 public <T extends Remote> T lookup(String reference, Class<T> contract) throws RemoteException {127 public synchronized <T extends Remote> T lookup(String reference, Class<T> contract) throws RemoteException { 126 128 try { 127 129 … … 131 133 } 132 134 133 if (! Proxymq.containsProxy(reference)) {135 if (!proxies.containsKey(reference)) { 134 136 Proxymq proxy = new Proxymq(reference, contract, this); 135 137 Class<?>[] array = { contract }; 136 return (T) Proxymq.newProxyInstance(contract.getClassLoader(), array, proxy); 138 Object newProxy = Proxymq.newProxyInstance(contract.getClassLoader(), array, proxy); 139 proxies.put(reference, newProxy); 140 return (T) newProxy; 137 141 } 138 return (T) Proxymq.getInstance(reference);142 return (T) proxies.get(reference); 139 143 140 144 } catch (Exception e) {
Note: See TracChangeset
for help on using the changeset viewer.