Changeset 82
- Timestamp:
- 07/05/13 16:51:11 (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/main/java/omq/Remote.java
r72 r82 4 4 5 5 /** 6 * 7 * The Remote interface serves to identify interfaces whose methods may be 8 * invoked from a non-local virtual machine. Any object that is a remote object 9 * must directly or indirectly implement this interface. Only those methods 10 * specified in a "remote interface", an interface that extends omq.Remote are 11 * available remotely. 6 12 * 7 13 * @author Sergi Toda <sergi.toda@estudiants.urv.cat> -
trunk/src/main/java/omq/client/annotation/MultiMethod.java
r54 r82 9 9 @Target(ElementType.METHOD) 10 10 public @interface MultiMethod { 11 /** 12 * If @MultiMethod is followed by @SyncMethod waitNum indicates how many 13 * responses we will wait for. 14 * 15 * @return length of the array of responses we are waiting for. 16 */ 11 17 int waitNum() default 1; 12 18 } -
trunk/src/main/java/omq/client/annotation/RemoteInterface.java
r44 r82 10 10 * Annotation which indicates which is the remote interface that can have 11 11 * asynchmethods or syncmethods. By default every method without an annotation 12 * will be classified as a SyncMethod 12 * will be classified as a SyncMethod. Both annotations can be preceded by the @MultiMethod 13 * annotation. 13 14 * 14 15 * @author Sergi Toda <sergi.toda@estudiants.urv.cat> -
trunk/src/main/java/omq/client/annotation/SyncMethod.java
r44 r82 17 17 @Target(ElementType.METHOD) 18 18 public @interface SyncMethod { 19 /** 20 * Timeout of a synchronous method 21 * 22 * @return how long we'll wait for a response 23 */ 19 24 long timeout() default 60000L; 20 25 26 /** 27 * Number of retries of a synchronous method 28 * 29 * @return how many retries we'll make. If the timeout is set, every timeout 30 * will use it 31 */ 21 32 int retry() default 1; 22 33 } -
trunk/src/main/java/omq/client/listener/ResponseListener.java
r56 r82 21 21 22 22 /** 23 * Class that inherits from RemoteListener. It's used in the server side. This 24 * class gets the deliveries from the server and stores them into the proxies 23 * Class that inherits from Thread. It's used in the client side. This class 24 * gets the deliveries from the server and stores them into the different 25 * proxies created. 25 26 * 26 27 * @author Sergi Toda <sergi.toda@estudiants.urv.cat> … … 38 39 39 40 /** 40 * Protected constructor used by the singleton pattern41 * ResponseListener constructor 41 42 * 42 * @param env43 * @param broker 43 44 * @throws Exception 44 45 */ … … 108 109 } 109 110 111 /** 112 * This function is used to start the response client queue 113 * 114 * @throws Exception 115 */ 110 116 private void startRPCQueue() throws Exception { 111 117 channel = broker.getNewChannel(); … … 151 157 } 152 158 153 // Revisar això 159 /** 160 * This method registers a new proxy into this responseListener 161 * 162 * @param proxy 163 */ 154 164 public void registerProxy(Proxymq proxy) { 165 // Since results is a hashtable this method doesn't need to be 166 // synchronized 155 167 if (!results.containsKey(proxy.getRef())) { 156 168 results.put(proxy.getRef(), proxy.getResults()); -
trunk/src/main/java/omq/client/proxy/Proxymq.java
r77 r82 27 27 28 28 /** 29 * EvoProxy class. This class inherits from InvocationHandler and gives you a 30 * proxy with a server using an environment 29 * Proxymq class. This class inherits from InvocationHandler, for this reason 30 * each proxymq instance has an associated invocation handler. When a method is 31 * invoked on a proxymq instance, the method invocation is encoded and 32 * dispatched to the invoke method of its invocation handler. 31 33 * 32 34 * @author Sergi Toda <sergi.toda@estudiants.urv.cat> … … 66 68 67 69 /** 68 * EvoProxyConstructor.70 * Proxymq Constructor. 69 71 * 70 72 * This constructor uses an uid to know which object will call. It also uses … … 131 133 } 132 134 135 /** 136 * This method publishes a request 137 * 138 * @param request 139 * - this request contains which method and which params will be 140 * invoked in the server side. 141 * @param replyQueueName 142 * - this param indicates where the responseListener will be 143 * listen to. 144 * @throws Exception 145 */ 133 146 private void publishMessage(Request request, String replyQueueName) throws Exception { 134 147 String corrId = request.getId(); … … 158 171 } 159 172 173 /** 174 * This method publishes a synchronous request 175 * 176 * @param request 177 * - this request contains which method and which params will be 178 * invoked in the server side. 179 * @param type 180 * - indicates which return type we are waiting for 181 * @return serverResponse 182 * @throws Exception 183 */ 160 184 private Object publishSyncRequest(Request request, Class<?> type) throws Exception { 161 185 String corrId = request.getId(); … … 170 194 publishMessage(request, replyQueueName); 171 195 if (request.isMulti()) { 172 return getResults(corrId, 2, timeout, type);196 return getResults(corrId, request.getWait(), timeout, type); 173 197 } else { 174 198 return getResult(corrId, timeout, type); … … 183 207 } 184 208 209 /** 210 * This method creates a request using the annotations of the Remote 211 * interface 212 * 213 * @param method 214 * - method to invoke in the server side 215 * @param arguments 216 * - arguments of the method 217 * @return new Request 218 */ 185 219 private Request createRequest(Method method, Object[] arguments) { 186 220 String corrId = java.util.UUID.randomUUID().toString(); -
trunk/src/test/java/omq/test/persistence/PersistentTest.java
r81 r82 85 85 serverBroker.bind(MESSAGE, msgImpl, msgImplProps); 86 86 87 // Stop the serverBroker 88 serverBroker.stopBroker(); 89 87 90 Broker clientBroker = new Broker(clientProps); 88 91 Message iMsg = clientBroker.lookup(MESSAGE, Message.class); … … 98 101 Thread.sleep(15000); 99 102 103 // Restart the server and listen to the new messages 104 serverBroker = new Broker(serverProps); 105 msgImpl = new MessageImpl(); 106 serverBroker.bind(MESSAGE, msgImpl, msgImplProps); 107 100 108 actual = iMsg.getMessage(); 101 109
Note: See TracChangeset
for help on using the changeset viewer.