Package java.rmi.server

Examples of java.rmi.server.RemoteCall


                        new Object[]{op[opnum].toString(), opnum, hash}));
            }
            logClientCall(obj, op[opnum].toString());
        }
        ClientConnection conn = ClientConnectionManager.getConnection(ep);
        RemoteCall call = new ClientRemoteCall(conn);

        if (clientRefLog.isLoggable(RMILog.VERBOSE)) {
            //rmi.log.102=Created new call {0}
            clientRefLog.log(RMILog.VERBOSE, Messages.getString("rmi.log.102", call)); //$NON-NLS-1$
        }

        try {
            // write method signature
            DataOutputStream dout = new DataOutputStream(conn.getOutputStream());
            dout.writeByte(RMIProtocolConstants.CALL_MSG);
            ObjectOutputStream oout =
                    (ObjectOutputStream) call.getOutputStream();
            objId.write(oout);
            oout.writeInt(opnum);
            oout.writeLong(hash);
            return call;
        } catch (IOException ioe) {
View Full Code Here


        if (clientCallLog.isLoggable(Log.VERBOSE)) {
            logClientCall(obj, method);
        }

        Connection conn = ref.getChannel().newConnection();
        RemoteCall call = null;
        boolean reuse = true;

        /* If the call connection is "reused" early, remember not to
         * reuse again.
         */
        boolean alreadyFreed = false;

        try {
            if (clientRefLog.isLoggable(Log.VERBOSE)) {
                clientRefLog.log(Log.VERBOSE, "opnum = " + opnum);
            }

            // create call context
            call = new StreamRemoteCall(conn, ref.getObjID(), -1, opnum);

            // marshal parameters
            try {
                ObjectOutput out = call.getOutputStream();
                marshalCustomCallData(out);
                Class<?>[] types = method.getParameterTypes();
                for (int i = 0; i < types.length; i++) {
                    marshalValue(types[i], params[i], out);
                }
            } catch (IOException e) {
                clientRefLog.log(Log.BRIEF,
                    "IOException marshalling arguments: ", e);
                throw new MarshalException("error marshalling arguments", e);
            }

            // unmarshal return
            call.executeCall();

            try {
                Class<?> rtype = method.getReturnType();
                if (rtype == void.class)
                    return null;
                ObjectInput in = call.getInputStream();

                /* StreamRemoteCall.done() does not actually make use
                 * of conn, therefore it is safe to reuse this
                 * connection before the dirty call is sent for
                 * registered refs.
                 */
                Object returnValue = unmarshalValue(rtype, in);

                /* we are freeing the connection now, do not free
                 * again or reuse.
                 */
                alreadyFreed = true;

                /* if we got to this point, reuse must have been true. */
                clientRefLog.log(Log.BRIEF, "free connection (reuse = true)");

                /* Free the call's connection early. */
                ref.getChannel().free(conn, true);

                return returnValue;

            } catch (IOException e) {
                clientRefLog.log(Log.BRIEF,
                                 "IOException unmarshalling return: ", e);
                throw new UnmarshalException("error unmarshalling return", e);
            } catch (ClassNotFoundException e) {
                clientRefLog.log(Log.BRIEF,
                    "ClassNotFoundException unmarshalling return: ", e);

                throw new UnmarshalException("error unmarshalling return", e);
            } finally {
                try {
                    call.done();
                } catch (IOException e) {
                    /* WARNING: If the conn has been reused early,
                     * then it is too late to recover from thrown
                     * IOExceptions caught here. This code is relying
                     * on StreamRemoteCall.done() not actually
View Full Code Here

            /* log information about the outgoing call */
            if (clientCallLog.isLoggable(Log.VERBOSE)) {
                logClientCall(obj, ops[opnum]);
            }

            RemoteCall call =
                new StreamRemoteCall(conn, ref.getObjID(), opnum, hash);
            try {
                marshalCustomCallData(call.getOutputStream());
            } catch (IOException e) {
                throw new MarshalException("error marshaling " +
                                           "custom call data");
            }
            return call;
View Full Code Here

                }

                switch (op) {
                case TransportConstants.Call:
                    // service incoming RMI call
                    RemoteCall call = new StreamRemoteCall(conn);
                    if (serviceCall(call) == false)
                        return;
                    break;

                case TransportConstants.Ping:
View Full Code Here

            clientRefLog.log(RMILog.BRIEF, Messages.getString("rmi.log.100", //$NON-NLS-1$
                m, h));
        }

        // initiate a new call
        RemoteCall call = newCall(null, null, -1, h);
        ((ClientRemoteCall) call).setMethod(m);


        try {
            // write arguments for the method called
            RMIObjectOutputStream oout =
                    (RMIObjectOutputStream) call.getOutputStream();
            Class[] paramTypes = m.getParameterTypes();

            try {
                if (params != null) {
                    for (int i = 0; i < params.length; ++i) {
                        oout.writeRMIObject(params[i], paramTypes[i]);
                    }
                }
            } catch (IOException ioe) {
                // rmi.6F=I/O error occurred while marshalling arguments
                throw new MarshalException(Messages.getString("rmi.6F"), ioe); //$NON-NLS-1$
            }

            // execute the call
            invoke(call);

            // read return value
            // if we pass here then server produced no exceptions
            if (m.getReturnType() != Void.TYPE) {
                RMIObjectInputStream oin =
                        (RMIObjectInputStream) call.getInputStream();

                try {
                    toReturn = oin.readRMIObject(m.getReturnType());
                } catch (IOException ioe) {
                    // rmi.70=IOException occurred while unmarshalling return value
View Full Code Here

                        new Object[]{op[opnum].toString(), opnum, hash}));
            }
            logClientCall(obj, op[opnum].toString());
        }
        ClientConnection conn = ClientConnectionManager.getConnection(ep);
        RemoteCall call = new ClientRemoteCall(conn);

        if (clientRefLog.isLoggable(RMILog.VERBOSE)) {
            //rmi.log.102=Created new call {0}
            clientRefLog.log(RMILog.VERBOSE, Messages.getString("rmi.log.102", call)); //$NON-NLS-1$
        }

        try {
            // write method signature
            DataOutputStream dout = new DataOutputStream(conn.getOutputStream());
            dout.writeByte(RMIProtocolConstants.CALL_MSG);
            ObjectOutputStream oout =
                    (ObjectOutputStream) call.getOutputStream();
            objId.write(oout);
            oout.writeInt(opnum);
            oout.writeLong(hash);
            return call;
        } catch (IOException ioe) {
View Full Code Here

            clientRefLog.log(RMILog.BRIEF, Messages.getString("rmi.log.100", //$NON-NLS-1$
                m, h));
        }

        // initiate a new call
        RemoteCall call = newCall(null, null, -1, h);
        ((ClientRemoteCall) call).setMethod(m);


        try {
            // write arguments for the method called
            RMIObjectOutputStream oout =
                    (RMIObjectOutputStream) call.getOutputStream();
            Class[] paramTypes = m.getParameterTypes();

            try {
                if (params != null) {
                    for (int i = 0; i < params.length; ++i) {
                        oout.writeRMIObject(params[i], paramTypes[i]);
                    }
                }
            } catch (IOException ioe) {
                // rmi.6F=I/O error occurred while marshalling arguments
                throw new MarshalException(Messages.getString("rmi.6F"), ioe); //$NON-NLS-1$
            }

            // execute the call
            invoke(call);

            // read return value
            // if we pass here then server produced no exceptions
            if (m.getReturnType() != Void.TYPE) {
                RMIObjectInputStream oin =
                        (RMIObjectInputStream) call.getInputStream();

                try {
                    toReturn = oin.readRMIObject(m.getReturnType());
                } catch (IOException ioe) {
                    // rmi.70=IOException occurred while unmarshalling return value
View Full Code Here

                        new Object[]{op[opnum].toString(), opnum, hash}));
            }
            logClientCall(obj, op[opnum].toString());
        }
        ClientConnection conn = ClientConnectionManager.getConnection(ep);
        RemoteCall call = new ClientRemoteCall(conn);

        if (clientRefLog.isLoggable(RMILog.VERBOSE)) {
            //rmi.log.102=Created new call {0}
            clientRefLog.log(RMILog.VERBOSE, Messages.getString("rmi.log.102", call)); //$NON-NLS-1$
        }

        try {
            // write method signature
            DataOutputStream dout = new DataOutputStream(conn.getOutputStream());
            dout.writeByte(RMIProtocolConstants.CALL_MSG);
            ObjectOutputStream oout =
                    (ObjectOutputStream) call.getOutputStream();
            objId.write(oout);
            oout.writeInt(opnum);
            oout.writeLong(hash);
            return call;
        } catch (IOException ioe) {
View Full Code Here

      {
        this.ref.invoke(this, $method_addGlobalJobListener_1, new Object[] { paramJobListener }, -6041517808460841247L);
      }
      else
      {
        RemoteCall localRemoteCall = this.ref.newCall(this, operations, 1, -426943571078592559L);
        try
        {
          ObjectOutput localObjectOutput = localRemoteCall.getOutputStream();
          localObjectOutput.writeObject(paramJobListener);
        }
        catch (IOException localIOException)
        {
          throw new MarshalException("error marshalling arguments", localIOException);
View Full Code Here

      {
        this.ref.invoke(this, $method_addGlobalTriggerListener_2, new Object[] { paramTriggerListener }, -8640695946527295764L);
      }
      else
      {
        RemoteCall localRemoteCall = this.ref.newCall(this, operations, 2, -426943571078592559L);
        try
        {
          ObjectOutput localObjectOutput = localRemoteCall.getOutputStream();
          localObjectOutput.writeObject(paramTriggerListener);
        }
        catch (IOException localIOException)
        {
          throw new MarshalException("error marshalling arguments", localIOException);
View Full Code Here

TOP

Related Classes of java.rmi.server.RemoteCall

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.