2 Replies Latest reply on Mar 22, 2007 1:26 PM by Ron Sigal

    behavior on failure

    Jose Luis Newbie

      Greetings.


      The org.jboss.remoting.Client class offers the invoke() and invokeOneWay() methods to do calls to the server side.

      If an error (not produced by my code) occurs during the call, for example:

      * The call is not delivered to the server.
      * The call's return value is not delivered to the client.


      Can I be SURE that a Throwable will be thrown to the client side?

      Something may/must happen in the server side?



      Analogously the org.jboss.remoting.callback.InvokerCallbackHandler interface offers the handleCallback() method to do callbacks to the client side.

      If an error (not produced by my code) occurs during the call, for example:

      * The callback is not delivered to the client side.


      Can I be SURE that a HandleCallbackException will be thrown to the server side?

      Something may/must happen in the client side?


      Thanks a lot for the help.

        • 1. behavior on failure (cont)
          Jose Luis Newbie

          The callbacks are "push callbacks"

          Another question:

          In the server side, I use the handleCallback() method to send a callback to a client.

          The handleCallback() method is invoked by my application thread.

          Is the serialization done by my application thread or another thread is used for the serialization?

          Is the callback delivered by my application thread or another thread is used for the delivering?

          what tasks are my application thread used for?

          Thanx in advance.

          • 2. Re: behavior on failure
            Ron Sigal Master

             


            The org.jboss.remoting.Client class offers the invoke() and invokeOneWay() methods to do calls to the server side.

            If an error (not produced by my code) occurs during the call, for example:

            * The call is not delivered to the server.
            * The call's return value is not delivered to the client.


            Can I be SURE that a Throwable will be thrown to the client side?

            Something may/must happen in the server side?


            The synchronous version Client.invoke() will either return a (possibly null) response or throw an exception, which could be generated during the transmission of the request, during processing on the server, or during transmission of the response. One exception would be if the connection has a timeout value of zero, which would allow the client to wait forever for a response on a broken connection.

            The asynchronous version Client.invokeOneway() passes the invocation to a separate thread, either on the client side or server side, and returns without waiting for either a response or an exception.

            The answer is the same for callback handling, which is implemented by calls to Client.invoke() and Client.invokeOneway().



            In the server side, I use the handleCallback() method to send a callback to a client.

            The handleCallback() method is invoked by my application thread.

            Is the serialization done by my application thread or another thread is used for the serialization?

            Is the callback delivered by my application thread or another thread is used for the delivering?

            what tasks are my application thread used for?


            When you call handleCallback(), the following things happen on your application thread:

            1. the callback is marshalled to the network (which by default involves serialization),

            2. the thread blocks waiting to read the response,

            3. the response is unmarshalled (which by default involves deserializing it) and returned.

            Of course, the answer would be different if you called handleCallbackOneway(), which acts like Client.invokeOneway().


            Is the callback delivered by my application thread or another thread is used for the delivering?


            I'm not sure I understand the question, but I'm assuming you're talking about delivering the callback to the InvokerCallbackHandler you registered on the client side. Typically, the callback delivery takes place not only on a different thread but in a different JVM. If the client and server are in the same JVM, then there are two possibilities. The default behavior is for the client invoker to make a direct method call on the server invoker, in which case the delivery would happen on your application thread. However, if you do this:

             HashMap config = new HashMap();
             config.put(InvokerLocator.FORCE_REMOTE, "true");
             connector = new Connector(serverLocator, config);
            


            the invocation will be handled through the transport and the delivery will occur on a separate thread in the server.