Package org.jboss.mx.remote

Examples of org.jboss.mx.remote.MethodInvocationResult


    }

    private Object deserializeResult(byte[] bytes) throws Exception, ClassNotFoundException
    {
        // de-serialize the method invocation result
        MethodInvocationResult result = (MethodInvocationResult) SerializationHelper.deserialize(bytes);

        //TODO -TME Need to check if exception.  If it is, then throw it?
        Object obj = result.getResult();
        return obj;
    }
View Full Code Here


        RemoteMethodInvocation method = new RemoteMethodInvocation(name, arg, sig);
        byte buf[] = SerializationHelper.serialize(method);

        byte[] bytes = connector.invoke(buf);
        // de-serialize the method invocation result
        MethodInvocationResult result = (MethodInvocationResult) SerializationHelper.deserialize(bytes);

        System.out.println("result = " + result);

        //TODO -TME Need to check if exception.  If it is, then throw it?
        Object obj = result.getResult();

        return obj;
    }
View Full Code Here

        {
            Object obj = SerializationHelper.deserialize(in0);
            RemoteMethodInvocation mi = (RemoteMethodInvocation) obj;
            Object invokeResult = connectorSvr.invoke(null, mi);

            MethodInvocationResult result = new MethodInvocationResult(invokeResult);
            // return the byte buffer result
            returnBuf = SerializationHelper.serialize(result);
        }
        catch(Throwable e)
        {
View Full Code Here

        byte[] returnBuf = null;
        try
        {
            Object invokeResult = connectorSvr.getNotifications(in0);

            MethodInvocationResult result = new MethodInvocationResult(invokeResult);
            // return the byte buffer result
            returnBuf = SerializationHelper.serialize(result);
        }
        catch(Throwable e)
        {
View Full Code Here

                        left -= amt;
                        in.write(buf, 0, amt);
                    }

                    // deserialize incoming buffer
                    MethodInvocationResult result = null;
                    try
                    {
                        // ask the executor to invoke the method
                        RemoteMethodInvocation mi = (RemoteMethodInvocation) SerializationHelper.deserialize(in.toByteArray());
                        result = new MethodInvocationResult(executor.invoke(addr, mi));
                    }
                    catch (ClassNotFoundException cnf)
                    {
                        log.error("Class Not Found during de-serializing of remote method invocation.",cnf);
                        result = new MethodInvocationResult(cnf);
                    }
                    catch (Throwable t)
                    {
                        if (logMethod && log.isDebugEnabled())
                        {
                            log.debug("Exception in method execution ...",t);
                        }
                        result = new MethodInvocationResult(t);
                    }

                    in = null;

                    // return the byte buffer result
View Full Code Here

        byte lenbuf[] = new byte[10];
        int maxrecv = socket.getSendBufferSize();
        int maxsend = socket.getReceiveBufferSize();

        MethodInvocationResult result = null;
        synchronized (invokeLock)
        {


            // write the method invocation to the output stream
            try
            {
                // first write out the buffer with the length
                SocketAcceptor.fill(lenbuf, buf.length);

                out.write(lenbuf, 0, 10);
                out.flush();

                int count = 0;
                int left = buf.length;

                // write out our invocation request buffer
                while (left > 0)
                {
                    int total = Math.min(left, maxsend);
                    out.write(buf, count, total);
                    count += total;
                    left -= total;
                }

                out.flush();

                // read in our response
                SocketAcceptor.zero(lenbuf);

                // read in the response's length
                in.read(lenbuf, 0, 10);

                int length = Integer.valueOf(new String(lenbuf)).intValue();

                ByteArrayOutputStream input = new ByteArrayOutputStream(length);

                count = 0;
                left = length;

                buf = new byte[Math.min(length, maxrecv)];

                while (left > 0)
                {
                    int amt = in.read(buf, 0, buf.length);
                    if (amt == -1)
                    {
                        break;
                    }
                    count += amt;
                    left -= amt;
                    input.write(buf, 0, amt);
                }

                // de-serialize the method invocation result
                result = (MethodInvocationResult) SerializationHelper.deserialize(input.toByteArray(),ccl);
                if (logMethod&&log.isDebugEnabled())
                {
                    log.debug("method returned result ... "+result+" for operation: "+name);
                }
            }
            catch (Throwable t)
            {
                if (t instanceof SocketException)
                {
                    try
                    {
                        stop();
                    }
                    catch (Exception ex)
                    {
                        if (log.isDebugEnabled())
                        {
                            log.warn("Exception stopping socket on SocketException", ex);
                        }
                    }
                    throw new ConnectionException("Connection has been closed",t);
                }
                throw t;
            }
            if (result.hasException())
            {
                throw result.getException();
            }
            else
            {
                return result.getResult();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.mx.remote.MethodInvocationResult

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.