Changeset 82 for trunk


Ignore:
Timestamp:
07/05/13 16:51:11 (11 years ago)
Author:
stoda
Message:

I've done some javadocs...

Location:
trunk
Files:
1 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/main/java/omq/Remote.java

    r72 r82  
    44
    55/**
     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.
    612 *
    713 * @author Sergi Toda <sergi.toda@estudiants.urv.cat>
  • trunk/src/main/java/omq/client/annotation/MultiMethod.java

    r54 r82  
    99@Target(ElementType.METHOD)
    1010public @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         */
    1117        int waitNum() default 1;
    1218}
  • trunk/src/main/java/omq/client/annotation/RemoteInterface.java

    r44 r82  
    1010 * Annotation which indicates which is the remote interface that can have
    1111 * 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.
    1314 *
    1415 * @author Sergi Toda <sergi.toda@estudiants.urv.cat>
  • trunk/src/main/java/omq/client/annotation/SyncMethod.java

    r44 r82  
    1717@Target(ElementType.METHOD)
    1818public @interface SyncMethod {
     19        /**
     20         * Timeout of a synchronous method
     21         *
     22         * @return how long we'll wait for a response
     23         */
    1924        long timeout() default 60000L;
    2025
     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         */
    2132        int retry() default 1;
    2233}
  • trunk/src/main/java/omq/client/listener/ResponseListener.java

    r56 r82  
    2121
    2222/**
    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.
    2526 *
    2627 * @author Sergi Toda <sergi.toda@estudiants.urv.cat>
     
    3839
    3940        /**
    40          * Protected constructor used by the singleton pattern
     41         * ResponseListener constructor
    4142         *
    42          * @param env
     43         * @param broker
    4344         * @throws Exception
    4445         */
     
    108109        }
    109110
     111        /**
     112         * This function is used to start the response client queue
     113         *
     114         * @throws Exception
     115         */
    110116        private void startRPCQueue() throws Exception {
    111117                channel = broker.getNewChannel();
     
    151157        }
    152158
    153         // Revisar això
     159        /**
     160         * This method registers a new proxy into this responseListener
     161         *
     162         * @param proxy
     163         */
    154164        public void registerProxy(Proxymq proxy) {
     165                // Since results is a hashtable this method doesn't need to be
     166                // synchronized
    155167                if (!results.containsKey(proxy.getRef())) {
    156168                        results.put(proxy.getRef(), proxy.getResults());
  • trunk/src/main/java/omq/client/proxy/Proxymq.java

    r77 r82  
    2727
    2828/**
    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.
    3133 *
    3234 * @author Sergi Toda <sergi.toda@estudiants.urv.cat>
     
    6668
    6769        /**
    68          * EvoProxy Constructor.
     70         * Proxymq Constructor.
    6971         *
    7072         * This constructor uses an uid to know which object will call. It also uses
     
    131133        }
    132134
     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         */
    133146        private void publishMessage(Request request, String replyQueueName) throws Exception {
    134147                String corrId = request.getId();
     
    158171        }
    159172
     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         */
    160184        private Object publishSyncRequest(Request request, Class<?> type) throws Exception {
    161185                String corrId = request.getId();
     
    170194                                publishMessage(request, replyQueueName);
    171195                                if (request.isMulti()) {
    172                                         return getResults(corrId, 2, timeout, type);
     196                                        return getResults(corrId, request.getWait(), timeout, type);
    173197                                } else {
    174198                                        return getResult(corrId, timeout, type);
     
    183207        }
    184208
     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         */
    185219        private Request createRequest(Method method, Object[] arguments) {
    186220                String corrId = java.util.UUID.randomUUID().toString();
  • trunk/src/test/java/omq/test/persistence/PersistentTest.java

    r81 r82  
    8585                serverBroker.bind(MESSAGE, msgImpl, msgImplProps);
    8686
     87                // Stop the serverBroker
     88                serverBroker.stopBroker();
     89
    8790                Broker clientBroker = new Broker(clientProps);
    8891                Message iMsg = clientBroker.lookup(MESSAGE, Message.class);
     
    98101                Thread.sleep(15000);
    99102
     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
    100108                actual = iMsg.getMessage();
    101109
Note: See TracChangeset for help on using the changeset viewer.