Package org.apache.harmony.rmi.transport

Examples of org.apache.harmony.rmi.transport.RMIObjectOutputStream


            try {
                skel.dispatch((Remote) ref.get(), call, op, h);
            } catch (Throwable t) {
                Exception ex = prepareException(m, t);
                RMIObjectOutputStream oout =
                        (RMIObjectOutputStream) call.getResultStream(false);
                oout.writeObject(ex);
            }

            try {
                call.getOutputStream().flush();
            } catch (IOException ioe) {
            }
            return;
        }

        // Using 1.2 RMI protocol version
        Method m = (Method) remoteMethods.get(new Long(h));

        if (m == null) {
            // rmi.66=Method with hash = {0} not found.
            throw new UnmarshalException(Messages.getString("rmi.66", h)); //$NON-NLS-1$
        }
        logServerCall(m.toString());
        Object[] params = readParams(m, oin);
        call.releaseInputStream();
        Object toReturn = null;
        Throwable toThrow = null;

        // locally call the method
        try {
            toReturn = m.invoke(ref.get(), params);
        } catch (InvocationTargetException ite) {
            toThrow = prepareException(m.toString(),
                    ((InvocationTargetException) ite).getTargetException());
        } catch (Throwable t) {
            toThrow = prepareException(m.toString(), t);
        }

        // return result of method call
        RMIObjectOutputStream oout =
                (RMIObjectOutputStream) call.getResultStream(toThrow == null);

        try {
            if (toThrow != null) {
                oout.writeObject(toThrow);
            } else if (toReturn != null) {
                oout.writeRMIObject(toReturn, m.getReturnType());
            } else if (m.getReturnType() != Void.TYPE) {
                oout.writeObject(null);
            }
            oout.flush();
        } catch (Error er) {
            // rmi.67=Error occured while marshalling return value
            throw new ServerError(Messages.getString("rmi.67"), er); //$NON-NLS-1$
        }
    }
View Full Code Here


        ((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 occured while marshalling arguments
                throw new MarshalException(Messages.getString("rmi.6F"), ioe); //$NON-NLS-1$
View Full Code Here

     * @throws IOException if an I/O error occured during stream construction
     */

    public ObjectOutput getOutputStream() throws IOException {
        if (oout == null) {
            oout = new RMIObjectOutputStream(conn.getOutputStream());
        }
        return oout;
    }
View Full Code Here

     * @throws IOException if an I/O error occured during stream construction
     */

    public ObjectOutput getOutputStream() throws IOException {
        if (oout == null) {
            oout = new RMIObjectOutputStream(conn.getOutputStream());
        }
        return oout;
    }
View Full Code Here

            throw new StreamCorruptedException(Messages.getString("rmi.7A")); //$NON-NLS-1$
        }
        (new DataOutputStream(conn.getOutputStream())).writeByte(CALL_OK);

        if (oout == null) {
            oout = new RMIObjectOutputStream(conn.getOutputStream(), true);
        }
        oout.writeByte(success ? RETURN_VAL : RETURN_EX);
        oout.writeUID();
        oout.flush();
        hasResStream = true;
View Full Code Here

    protected void writeCommon(ObjectOutput out) throws IOException {
        objId.write(out);
        boolean isResStream = false;

        if (out instanceof RMIObjectOutputStream) {
            RMIObjectOutputStream oout = (RMIObjectOutputStream) out;
            isResStream = oout.isResultStream();

            if (isResStream) {
                /*
                 * Because this is a result stream (i.e. obtained in
                 * RemoteCall.getResultStream() method), after writing all
                 * objects we will wait for DGC ack call. So, we should register
                 * this ref for holding a strong reference to the referenced
                 * remote object.
                 */
                ClientDGC.registerForDGCAck(oout.getUID(), this);
            }
        }
        out.writeBoolean(isResStream);
    }
View Full Code Here

                rLog.log(commonDebugLevel, Messages.getString("rmi.log.65", //$NON-NLS-1$
                        process));
                incarnation++;

                OutputStream os = process.getOutputStream();
                RMIObjectOutputStream oos = new RMIObjectOutputStream(
                        new BufferedOutputStream(os));

                oos.writeObject(agid);

                // rmi.log.66=Agid written: {0}
                rLog.log(commonDebugLevel, Messages.getString("rmi.log.66", agid)); //$NON-NLS-1$
                oos.writeObject(agdesc);
                // rmi.log.67=Agdesc written: {0}
                rLog.log(commonDebugLevel, Messages.getString("rmi.log.67", agdesc)); //$NON-NLS-1$

                oos.writeLong(incarnation);
                // rmi.log.68=incarnation written: {0}
                rLog.log(commonDebugLevel, Messages.getString("rmi.log.68", //$NON-NLS-1$
                        incarnation));

                oos.flush();
                // rmi.log.69=flushed
                rLog.log(commonDebugLevel, Messages.getString("rmi.log.69")); //$NON-NLS-1$

                oos.close();
                os.close();
                // rmi.log.6A=closed
                rLog.log(commonDebugLevel, Messages.getString("rmi.log.6A")); //$NON-NLS-1$

                if (activationInstantiator == null) {
View Full Code Here

                        // rmi.log.10B=Return exception to the client: {0}
                        ServerConnectionManager.transportLog.log(RMILog.VERBOSE,
                                Messages.getString("rmi.log.10B", exToReturn));//$NON-NLS-1$
                    }
                    DataOutputStream dout = new DataOutputStream(out);
                    RMIObjectOutputStream oout;

                    if (sCall.hasResultStream()) {
                        oout = (RMIObjectOutputStream)
                                sCall.getOutputStream();
                    } else {
                        oout = (RMIObjectOutputStream)
                                sCall.getResultStream(false);
                    }
                    oout.writeObject(exToReturn);
                    oout.flush();
                }

                if (sref != null) {
                    if (!sref.isSystem()) {
                        mgr.removeActiveCall();
View Full Code Here

                        // rmi.log.10B=Return exception to the client: {0}
                        ServerConnectionManager.transportLog.log(RMILog.VERBOSE,
                                Messages.getString("rmi.log.10B", exToReturn));//$NON-NLS-1$
                    }
                    DataOutputStream dout = new DataOutputStream(out);
                    RMIObjectOutputStream oout;

                    if (sCall.hasResultStream()) {
                        oout = (RMIObjectOutputStream)
                                sCall.getOutputStream();
                    } else {
                        oout = (RMIObjectOutputStream)
                                sCall.getResultStream(false);
                    }
                    oout.writeObject(exToReturn);
                    oout.flush();
                }

                if (sref != null) {
                    if (!sref.isSystem()) {
                        mgr.removeActiveCall();
View Full Code Here

     * @throws IOException if an I/O error occurred during stream construction
     */

    public ObjectOutput getOutputStream() throws IOException {
        if (oout == null) {
            oout = new RMIObjectOutputStream(conn.getOutputStream());
        }
        return oout;
    }
View Full Code Here

TOP

Related Classes of org.apache.harmony.rmi.transport.RMIObjectOutputStream

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.