Changeset 82 for trunk/src/main/java/omq/client
- Timestamp:
- 07/05/13 16:51:11 (11 years ago)
- Location:
- trunk/src/main/java/omq/client
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
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();
Note: See TracChangeset
for help on using the changeset viewer.