Package org.exolab.jms.net.connector

Examples of org.exolab.jms.net.connector.Response


     * @param connection the connection invoking the request
     * @param request    the request
     * @return the response
     */
    protected Response invoke(Connection connection, Request request) {
        Response response;
        Multiplexer multiplexer;
        synchronized (this) {
            multiplexer = _multiplexer;
        }
        if (multiplexer != null) {
            Channel channel = null;
            try {
                channel = multiplexer.getChannel();
                response = channel.invoke(request);
                channel.release();
            } catch (Exception exception) {
                _log.debug(exception, exception);
                response = new Response(exception);
                if (channel != null) {
                    channel.destroy();
                }
            }
        } else {
            response = new Response(new ResourceException("Connection lost"));
        }

        return response;
    }
View Full Code Here


         * @param invocation the invocation
         */
        public void invoke(final Invocation invocation) {
            Runnable invoker = new Runnable() {
                public void run() {
                    Response response;
                    try {
                        Request request = invocation.getRequest();
                        Caller caller = invocation.getCaller();
                        response = invoke(request, caller);
                    } catch (Throwable exception) {
                        response = new Response(exception);
                    }
                    invocation.setResponse(response);
                }
            };

            try {
                getThreadPool().execute(invoker);
            } catch (Throwable exception) {
                _log.debug("Pool failed to execute invocation", exception);
                invocation.setResponse(new Response(exception));
            }
        }
View Full Code Here

         * @param request the request
         * @param caller  the caller performing the invocation
         * @return the result of the invocation
         */
        protected Response invoke(Request request, Caller caller) {
            Response response;
            try {
                Object object = getObject(request.getObjID(),
                        request.getURI());
                Method method = request.getMethod();
                if (method == null) {
                    // resolve the method using its id
                    method = getMethod(object, request.getMethodID());
                }
                Object[] args = request.getArgs();
                if (args == null) {
                    // deserialize the arguments
                    args = request.readArgs(method);
                }
                if (_log.isDebugEnabled()) {
                    _log.debug("Invoking " + method + " on " + object);
                }
                _caller.set(caller);
                Object result = method.invoke(object, args);
                response = new Response(result, method);
            } catch (InvocationTargetException exception) {
                Throwable target = exception.getTargetException();
                if (target == null) {
                    target = exception;
                }
                response = new Response(target);
            } catch (Throwable exception) {
                response = new Response(exception);
            } finally {
                _caller.set(null);
            }
            return response;
        }
View Full Code Here

     * @param connection the connection performing the invocation
     * @param request    the request
     * @return the result of the invocation
     */
    protected Response invoke(Connection connection, Request request) {
        Response response;
        try {
            MarshalledObject wrappedRequest = new MarshalledObject(request);
            MarshalledObject wrappedResponse =
                    _remoteInvoker.invoke(wrappedRequest);
            response = (Response) wrappedResponse.get();
        } catch (ClassNotFoundException exception) {
            response = new Response(exception);
        } catch (IOException exception) {
            response = new Response(exception);
        }
        return response;
    }
View Full Code Here

     */
    public Response invoke(Request request) throws RemoteException {
        if (_log.isDebugEnabled()) {
            _log.debug("invoke() [channel=" + _id + "]");
        }
        Response response;
        ObjectOutputStream out = null;
        try {
            // set the packet type
            _out.setType(REQUEST);

View Full Code Here

     * @throws Throwable for any error
     */
    public Object invoke(Method method, Object[] args, long methodID)
            throws Throwable {
        Request request = new Request(_objID, method, args, methodID);
        Response response = getConnection().invoke(request);
        if (response.isException()) {
            throw response.getException();
        }
        return response.getObject();
    }
View Full Code Here

     * @return the result of the invocation
     * @throws RemoteException if the distributed call cannot be made
     */
    protected Response invoke(Connection connection, Request request)
            throws RemoteException {
        Response response;
        try {
            MarshalledObject wrappedRequest = new MarshalledObject(request);
            MarshalledObject wrappedResponse =
                    _remoteInvoker.invoke(wrappedRequest);
            response = (Response) wrappedResponse.get();
        } catch (ClassNotFoundException exception) {
            response = new Response(exception);
        } catch (IOException exception) {
            response = new Response(exception);
        }
        return response;
    }
View Full Code Here

TOP

Related Classes of org.exolab.jms.net.connector.Response

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.