com.sun.corba.se.pept.encoding.OutputObject Java Examples

The following examples show how to use com.sun.corba.se.pept.encoding.OutputObject. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BufferManagerWriteStream.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private void sendFragment(boolean isLastFragment)
{
    Connection conn = ((OutputObject)outputObject).getMessageMediator().getConnection();

    // REVISIT: need an ORB
    //System.out.println("sendFragment: last?: " + isLastFragment);
    conn.writeLock();

    try {
        // Send the fragment
        conn.sendWithoutLock(((OutputObject)outputObject));

        fragmentCount++;

    } finally {

        conn.writeUnlock();
    }

}
 
Example #2
Source File: BufferManagerWriteStream.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void sendFragment(boolean isLastFragment)
{
    Connection conn = ((OutputObject)outputObject).getMessageMediator().getConnection();

    // REVISIT: need an ORB
    //System.out.println("sendFragment: last?: " + isLastFragment);
    conn.writeLock();

    try {
        // Send the fragment
        conn.sendWithoutLock(((OutputObject)outputObject));

        fragmentCount++;

    } finally {

        conn.writeUnlock();
    }

}
 
Example #3
Source File: SocketOrChannelAcceptorImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public OutputObject createOutputObject(Broker broker,
                                       MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;
    return sun.corba.OutputStreamFactory.newCDROutputObject((ORB) broker,
                   corbaMessageMediator, corbaMessageMediator.getReplyHeader(),
                   corbaMessageMediator.getStreamFormatVersion());
}
 
Example #4
Source File: CorbaClientDelegateImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public InputStream invoke(org.omg.CORBA.Object self, OutputStream output)
    throws
        ApplicationException,
        RemarshalException
{
    ClientRequestDispatcher subcontract = getClientRequestDispatcher();
    return (InputStream)
        subcontract.marshalingComplete((Object)self, (OutputObject)output);
}
 
Example #5
Source File: CorbaClientDelegateImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public InputStream invoke(org.omg.CORBA.Object self, OutputStream output)
    throws
        ApplicationException,
        RemarshalException
{
    ClientRequestDispatcher subcontract = getClientRequestDispatcher();
    return (InputStream)
        subcontract.marshalingComplete((Object)self, (OutputObject)output);
}
 
Example #6
Source File: SharedCDRContactInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public OutputObject createOutputObject(MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;
    // NOTE: GROW.
    OutputObject outputObject =
        sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
                            corbaMessageMediator.getRequestHeader(),
                            corbaMessageMediator.getStreamFormatVersion(),
                            BufferManagerFactory.GROW);
    messageMediator.setOutputObject(outputObject);
    return outputObject;
}
 
Example #7
Source File: CorbaClientDelegateImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public InputStream invoke(org.omg.CORBA.Object self, OutputStream output)
    throws
        ApplicationException,
        RemarshalException
{
    ClientRequestDispatcher subcontract = getClientRequestDispatcher();
    return (InputStream)
        subcontract.marshalingComplete((Object)self, (OutputObject)output);
}
 
Example #8
Source File: CorbaContactInfoBase.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public OutputObject createOutputObject(MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;

    OutputObject outputObject =
        sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
                            corbaMessageMediator.getRequestHeader(),
                            corbaMessageMediator.getStreamFormatVersion());

    messageMediator.setOutputObject(outputObject);
    return outputObject;
}
 
Example #9
Source File: CorbaContactInfoBase.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public OutputObject createOutputObject(MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;

    OutputObject outputObject =
        sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
                            corbaMessageMediator.getRequestHeader(),
                            corbaMessageMediator.getStreamFormatVersion());

    messageMediator.setOutputObject(outputObject);
    return outputObject;
}
 
Example #10
Source File: CorbaClientDelegateImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public InputStream invoke(org.omg.CORBA.Object self, OutputStream output)
    throws
        ApplicationException,
        RemarshalException
{
    ClientRequestDispatcher subcontract = getClientRequestDispatcher();
    return (InputStream)
        subcontract.marshalingComplete((Object)self, (OutputObject)output);
}
 
Example #11
Source File: CorbaMessageMediatorImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void endRequest(CorbaMessageMediator messageMediator)
{
    ORB orb = (ORB) messageMediator.getBroker();
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest<-: " + opAndId(messageMediator));
    }

    // release NIO ByteBuffers to ByteBufferPool

    try {
        OutputObject outputObj = messageMediator.getOutputObject();
        if (outputObj != null) {
            outputObj.close();
        }
        InputObject inputObj = messageMediator.getInputObject();
        if (inputObj != null) {
            inputObj.close();
        }
    } catch (IOException ex) {
        // Given what close() does, this catch shouldn't ever happen.
        // See CDRInput/OutputObject.close() for more info.
        // It also won't result in a Corba error if an IOException happens.
        if (orb.subcontractDebugFlag) {
            dprint(".endRequest: IOException:" + ex.getMessage(), ex);
        }
    } finally {
        ((CorbaConnection)messageMediator.getConnection()).serverRequestProcessingEnds();
    }
}
 
Example #12
Source File: CorbaContactInfoBase.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public OutputObject createOutputObject(MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;

    OutputObject outputObject =
        sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
                            corbaMessageMediator.getRequestHeader(),
                            corbaMessageMediator.getStreamFormatVersion());

    messageMediator.setOutputObject(outputObject);
    return outputObject;
}
 
Example #13
Source File: CorbaContactInfoBase.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public OutputObject createOutputObject(MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;

    OutputObject outputObject =
        sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
                            corbaMessageMediator.getRequestHeader(),
                            corbaMessageMediator.getStreamFormatVersion());

    messageMediator.setOutputObject(outputObject);
    return outputObject;
}
 
Example #14
Source File: CorbaContactInfoBase.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public OutputObject createOutputObject(MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;

    OutputObject outputObject =
        sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
                            corbaMessageMediator.getRequestHeader(),
                            corbaMessageMediator.getStreamFormatVersion());

    messageMediator.setOutputObject(outputObject);
    return outputObject;
}
 
Example #15
Source File: SharedCDRContactInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public OutputObject createOutputObject(MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;
    // NOTE: GROW.
    OutputObject outputObject =
        sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
                            corbaMessageMediator.getRequestHeader(),
                            corbaMessageMediator.getStreamFormatVersion(),
                            BufferManagerFactory.GROW);
    messageMediator.setOutputObject(outputObject);
    return outputObject;
}
 
Example #16
Source File: CorbaMessageMediatorImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void endRequest(CorbaMessageMediator messageMediator)
{
    ORB orb = (ORB) messageMediator.getBroker();
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest<-: " + opAndId(messageMediator));
    }

    // release NIO ByteBuffers to ByteBufferPool

    try {
        OutputObject outputObj = messageMediator.getOutputObject();
        if (outputObj != null) {
            outputObj.close();
        }
        InputObject inputObj = messageMediator.getInputObject();
        if (inputObj != null) {
            inputObj.close();
        }
    } catch (IOException ex) {
        // Given what close() does, this catch shouldn't ever happen.
        // See CDRInput/OutputObject.close() for more info.
        // It also won't result in a Corba error if an IOException happens.
        if (orb.subcontractDebugFlag) {
            dprint(".endRequest: IOException:" + ex.getMessage(), ex);
        }
    } finally {
        ((CorbaConnection)messageMediator.getConnection()).serverRequestProcessingEnds();
    }
}
 
Example #17
Source File: CorbaMessageMediatorImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void endRequest(CorbaMessageMediator messageMediator)
{
    ORB orb = (ORB) messageMediator.getBroker();
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest<-: " + opAndId(messageMediator));
    }

    // release NIO ByteBuffers to ByteBufferPool

    try {
        OutputObject outputObj = messageMediator.getOutputObject();
        if (outputObj != null) {
            outputObj.close();
        }
        InputObject inputObj = messageMediator.getInputObject();
        if (inputObj != null) {
            inputObj.close();
        }
    } catch (IOException ex) {
        // Given what close() does, this catch shouldn't ever happen.
        // See CDRInput/OutputObject.close() for more info.
        // It also won't result in a Corba error if an IOException happens.
        if (orb.subcontractDebugFlag) {
            dprint(".endRequest: IOException:" + ex.getMessage(), ex);
        }
    } finally {
        ((CorbaConnection)messageMediator.getConnection()).serverRequestProcessingEnds();
    }
}
 
Example #18
Source File: SharedCDRContactInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public OutputObject createOutputObject(MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;
    // NOTE: GROW.
    OutputObject outputObject =
        sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
                            corbaMessageMediator.getRequestHeader(),
                            corbaMessageMediator.getStreamFormatVersion(),
                            BufferManagerFactory.GROW);
    messageMediator.setOutputObject(outputObject);
    return outputObject;
}
 
Example #19
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void endRequest(CorbaMessageMediator messageMediator)
{
    ORB orb = (ORB) messageMediator.getBroker();
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest<-: " + opAndId(messageMediator));
    }

    // release NIO ByteBuffers to ByteBufferPool

    try {
        OutputObject outputObj = messageMediator.getOutputObject();
        if (outputObj != null) {
            outputObj.close();
        }
        InputObject inputObj = messageMediator.getInputObject();
        if (inputObj != null) {
            inputObj.close();
        }
    } catch (IOException ex) {
        // Given what close() does, this catch shouldn't ever happen.
        // See CDRInput/OutputObject.close() for more info.
        // It also won't result in a Corba error if an IOException happens.
        if (orb.subcontractDebugFlag) {
            dprint(".endRequest: IOException:" + ex.getMessage(), ex);
        }
    } finally {
        ((CorbaConnection)messageMediator.getConnection()).serverRequestProcessingEnds();
    }
}
 
Example #20
Source File: CorbaContactInfoBase.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public OutputObject createOutputObject(MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;

    OutputObject outputObject =
        sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
                            corbaMessageMediator.getRequestHeader(),
                            corbaMessageMediator.getStreamFormatVersion());

    messageMediator.setOutputObject(outputObject);
    return outputObject;
}
 
Example #21
Source File: SocketOrChannelAcceptorImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public OutputObject createOutputObject(Broker broker,
                                       MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;
    return sun.corba.OutputStreamFactory.newCDROutputObject((ORB) broker,
                   corbaMessageMediator, corbaMessageMediator.getReplyHeader(),
                   corbaMessageMediator.getStreamFormatVersion());
}
 
Example #22
Source File: CorbaMessageMediatorImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
protected CorbaMessageMediator createResponseHelper(
    CorbaMessageMediator messageMediator, ReplyMessage reply, IOR ior)
{
    // REVISIT - these should be invoked from subcontract.
    runServantPostInvoke(messageMediator);
    runInterceptors(messageMediator, reply);
    runRemoveThreadInfo(messageMediator);

    if (((ORB)messageMediator.getBroker()).subcontractDebugFlag) {
        dprint(".createResponseHelper: "
               + opAndId(messageMediator) + ": "
               + reply);
    }

    messageMediator.setReplyHeader(reply);

    OutputObject replyOutputObject;
    // REVISIT = do not use null.
    //
    if (messageMediator.getConnection() == null) {
        replyOutputObject =
            sun.corba.OutputStreamFactory.newCDROutputObject(orb,
                        messageMediator, messageMediator.getReplyHeader(),
                        messageMediator.getStreamFormatVersion(),
                        BufferManagerFactory.GROW);
    } else {
        replyOutputObject = messageMediator.getConnection().getAcceptor()
         .createOutputObject(messageMediator.getBroker(), messageMediator);
    }
    messageMediator.setOutputObject(replyOutputObject);
    messageMediator.getOutputObject().setMessageMediator(messageMediator);

    reply.write((OutputStream) messageMediator.getOutputObject());
    if (reply.getIOR() != null) {
        reply.getIOR().write((OutputStream) messageMediator.getOutputObject());
    }
    // REVISIT - not necessary?
    //messageMediator.this.replyIOR = reply.getIOR();

    // NOTE: The mediator holds onto output object so return value
    // not really necessary.
    return messageMediator;
}
 
Example #23
Source File: CorbaClientRequestDispatcherImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void endRequest(Broker broker, Object self, InputObject inputObject)
{
    ORB orb = (ORB)broker ;

    try {
        if (orb.subcontractDebugFlag) {
            dprint(".endRequest->");
        }

        // Note: the inputObject may be null if an error occurs
        //       in request or before _invoke returns.
        // Note: self may be null also (e.g., compiler generates null in stub).

        MessageMediator messageMediator =
            orb.getInvocationInfo().getMessageMediator();
        if (messageMediator != null)
        {
            if (messageMediator.getConnection() != null)
            {
                ((CorbaMessageMediator)messageMediator)
                          .sendCancelRequestIfFinalFragmentNotSent();
            }

            // Release any outstanding NIO ByteBuffers to the ByteBufferPool

            InputObject inputObj = messageMediator.getInputObject();
            if (inputObj != null) {
                inputObj.close();
            }

            OutputObject outputObj = messageMediator.getOutputObject();
            if (outputObj != null) {
                outputObj.close();
            }

        }

        // XREVISIT NOTE - Assumes unregistering the waiter for
        // location forwards has already happened somewhere else.
        // The code below is only going to unregister the final successful
        // request.

        // NOTE: In the case of a recursive stack of endRequests in a
        // finally block (because of Remarshal) only the first call to
        // unregisterWaiter will remove the waiter.  The rest will be
        // noops.
        unregisterWaiter(orb);

        // Invoke Portable Interceptors cleanup.  This is done to handle
        // exceptions during stream marshaling.  More generally, exceptions
        // that occur in the ORB after send_request (which includes
        // after returning from _request) before _invoke:
        orb.getPIHandler().cleanupClientPIRequest();

        // REVISIT: Early replies?
    } catch (IOException ex) {
        // See CDRInput/OutputObject.close() for more info.
        // This won't result in a Corba error if an IOException happens.
        if (orb.subcontractDebugFlag)
        {
            dprint(".endRequest: ignoring IOException - " + ex.toString());
        }
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".endRequest<-");
        }
    }
}
 
Example #24
Source File: CorbaClientRequestDispatcherImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void endRequest(Broker broker, Object self, InputObject inputObject)
{
    ORB orb = (ORB)broker ;

    try {
        if (orb.subcontractDebugFlag) {
            dprint(".endRequest->");
        }

        // Note: the inputObject may be null if an error occurs
        //       in request or before _invoke returns.
        // Note: self may be null also (e.g., compiler generates null in stub).

        MessageMediator messageMediator =
            orb.getInvocationInfo().getMessageMediator();
        if (messageMediator != null)
        {
            if (messageMediator.getConnection() != null)
            {
                ((CorbaMessageMediator)messageMediator)
                          .sendCancelRequestIfFinalFragmentNotSent();
            }

            // Release any outstanding NIO ByteBuffers to the ByteBufferPool

            InputObject inputObj = messageMediator.getInputObject();
            if (inputObj != null) {
                inputObj.close();
            }

            OutputObject outputObj = messageMediator.getOutputObject();
            if (outputObj != null) {
                outputObj.close();
            }

        }

        // XREVISIT NOTE - Assumes unregistering the waiter for
        // location forwards has already happened somewhere else.
        // The code below is only going to unregister the final successful
        // request.

        // NOTE: In the case of a recursive stack of endRequests in a
        // finally block (because of Remarshal) only the first call to
        // unregisterWaiter will remove the waiter.  The rest will be
        // noops.
        unregisterWaiter(orb);

        // Invoke Portable Interceptors cleanup.  This is done to handle
        // exceptions during stream marshaling.  More generally, exceptions
        // that occur in the ORB after send_request (which includes
        // after returning from _request) before _invoke:
        orb.getPIHandler().cleanupClientPIRequest();

        // REVISIT: Early replies?
    } catch (IOException ex) {
        // See CDRInput/OutputObject.close() for more info.
        // This won't result in a Corba error if an IOException happens.
        if (orb.subcontractDebugFlag)
        {
            dprint(".endRequest: ignoring IOException - " + ex.toString());
        }
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".endRequest<-");
        }
    }
}
 
Example #25
Source File: SocketOrChannelConnectionImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public OutputObject createOutputObject(MessageMediator messageMediator)
{
    // REVISIT - remove this method from Connection and all it subclasses.
    throw new RuntimeException("*****SocketOrChannelConnectionImpl.createOutputObject - should not be called.");
}
 
Example #26
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected CorbaMessageMediator createResponseHelper(
    CorbaMessageMediator messageMediator, ReplyMessage reply, IOR ior)
{
    // REVISIT - these should be invoked from subcontract.
    runServantPostInvoke(messageMediator);
    runInterceptors(messageMediator, reply);
    runRemoveThreadInfo(messageMediator);

    if (((ORB)messageMediator.getBroker()).subcontractDebugFlag) {
        dprint(".createResponseHelper: "
               + opAndId(messageMediator) + ": "
               + reply);
    }

    messageMediator.setReplyHeader(reply);

    OutputObject replyOutputObject;
    // REVISIT = do not use null.
    //
    if (messageMediator.getConnection() == null) {
        replyOutputObject =
            sun.corba.OutputStreamFactory.newCDROutputObject(orb,
                        messageMediator, messageMediator.getReplyHeader(),
                        messageMediator.getStreamFormatVersion(),
                        BufferManagerFactory.GROW);
    } else {
        replyOutputObject = messageMediator.getConnection().getAcceptor()
         .createOutputObject(messageMediator.getBroker(), messageMediator);
    }
    messageMediator.setOutputObject(replyOutputObject);
    messageMediator.getOutputObject().setMessageMediator(messageMediator);

    reply.write((OutputStream) messageMediator.getOutputObject());
    if (reply.getIOR() != null) {
        reply.getIOR().write((OutputStream) messageMediator.getOutputObject());
    }
    // REVISIT - not necessary?
    //messageMediator.this.replyIOR = reply.getIOR();

    // NOTE: The mediator holds onto output object so return value
    // not really necessary.
    return messageMediator;
}
 
Example #27
Source File: BufferManagerWriteCollect.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void sendMessage ()
{
    // Enqueue the last fragment
    queue.enqueue(((CDROutputObject)outputObject).getByteBufferWithInfo());

    Iterator bufs = iterator();

    Connection conn =
                      ((OutputObject)outputObject).getMessageMediator().
                                                   getConnection();

    // With the collect strategy, we must lock the connection
    // while fragments are being sent.  This is so that there are
    // no interleved fragments in GIOP 1.1.
    //
    // Note that this thread must not call writeLock again in any
    // of its send methods!
    conn.writeLock();

    try {

        // Get a reference to ByteBufferPool so that the ByteBufferWithInfo
        // ByteBuffer can be released to the ByteBufferPool
        ByteBufferPool byteBufferPool = orb.getByteBufferPool();

        while (bufs.hasNext()) {

            ByteBufferWithInfo bbwi = (ByteBufferWithInfo)bufs.next();
            ((CDROutputObject)outputObject).setByteBufferWithInfo(bbwi);

            conn.sendWithoutLock(((CDROutputObject)outputObject));

            sentFragment = true;

            // Release ByteBufferWithInfo's ByteBuffer back to the pool
            // of ByteBuffers.
            if (debug)
            {
                // print address of ByteBuffer being released
                int bbAddress = System.identityHashCode(bbwi.byteBuffer);
                StringBuffer sb = new StringBuffer(80);
                sb.append("sendMessage() - releasing ByteBuffer id (");
                sb.append(bbAddress).append(") to ByteBufferPool.");
                String msg = sb.toString();
                dprint(msg);
            }
            byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
            bbwi.byteBuffer = null;
            bbwi = null;
        }

        sentFullMessage = true;

    } finally {

        conn.writeUnlock();
    }
}
 
Example #28
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public OutputObject getOutputObject()
{
    return outputObject;
}
 
Example #29
Source File: SocketOrChannelConnectionImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void sendWithoutLock(OutputObject outputObject)
{
    // Don't we need to check for CloseConnection
    // here?  REVISIT

    // XREVISIT - Shouldn't the MessageMediator
    // be the one to handle writing the data here?

    try {

        // Write the fragment/message

        CDROutputObject cdrOutputObject = (CDROutputObject) outputObject;
        cdrOutputObject.writeTo(this);
        // REVISIT - no flush?
        //socket.getOutputStream().flush();

    } catch (IOException e1) {

        /*
         * ADDED(Ram J) 10/13/2000 In the event of an IOException, try
         * sending a CancelRequest for regular requests / locate requests
         */

        // Since IIOPOutputStream's msgheader is set only once, and not
        // altered during sending multiple fragments, the original
        // msgheader will always have the requestId.
        // REVISIT This could be optimized to send a CancelRequest only
        // if any fragments had been sent already.

        /* REVISIT: MOVE TO SUBCONTRACT
        Message msg = os.getMessage();
        if (msg.getType() == Message.GIOPRequest ||
                msg.getType() == Message.GIOPLocateRequest) {
            GIOPVersion requestVersion = msg.getGIOPVersion();
            int requestId = MessageBase.getRequestId(msg);
            try {
                sendCancelRequest(requestVersion, requestId);
            } catch (IOException e2) {
                // most likely an abortive connection closure.
                // ignore, since nothing more can be done.
                if (orb.transportDebugFlag) {

            }
        }
        */

        // REVISIT When a send failure happens, purgeCalls() need to be
        // called to ensure that the connection is properly removed from
        // further usage (ie., cancelling pending requests with COMM_FAILURE
        // with an appropriate minor_code CompletionStatus.MAY_BE).

        // Relying on the IIOPOutputStream (as noted below) is not
        // sufficient as it handles COMM_FAILURE only for the final
        // fragment (during invoke processing). Note that COMM_FAILURE could
        // happen while sending the initial fragments.
        // Also the IIOPOutputStream does not properly close the connection.
        // It simply removes the connection from the table. An orderly
        // closure is needed (ie., cancel pending requests on the connection
        // COMM_FAILURE as well.

        // IIOPOutputStream will cleanup the connection info when it
        // sees this exception.
        SystemException exc = wrapper.writeErrorSend(e1);
        purgeCalls(exc, false, true);
        throw exc;
    }
}
 
Example #30
Source File: SocketOrChannelConnectionImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void sendWithoutLock(OutputObject outputObject)
{
    // Don't we need to check for CloseConnection
    // here?  REVISIT

    // XREVISIT - Shouldn't the MessageMediator
    // be the one to handle writing the data here?

    try {

        // Write the fragment/message

        CDROutputObject cdrOutputObject = (CDROutputObject) outputObject;
        cdrOutputObject.writeTo(this);
        // REVISIT - no flush?
        //socket.getOutputStream().flush();

    } catch (IOException e1) {

        /*
         * ADDED(Ram J) 10/13/2000 In the event of an IOException, try
         * sending a CancelRequest for regular requests / locate requests
         */

        // Since IIOPOutputStream's msgheader is set only once, and not
        // altered during sending multiple fragments, the original
        // msgheader will always have the requestId.
        // REVISIT This could be optimized to send a CancelRequest only
        // if any fragments had been sent already.

        /* REVISIT: MOVE TO SUBCONTRACT
        Message msg = os.getMessage();
        if (msg.getType() == Message.GIOPRequest ||
                msg.getType() == Message.GIOPLocateRequest) {
            GIOPVersion requestVersion = msg.getGIOPVersion();
            int requestId = MessageBase.getRequestId(msg);
            try {
                sendCancelRequest(requestVersion, requestId);
            } catch (IOException e2) {
                // most likely an abortive connection closure.
                // ignore, since nothing more can be done.
                if (orb.transportDebugFlag) {

            }
        }
        */

        // REVISIT When a send failure happens, purgeCalls() need to be
        // called to ensure that the connection is properly removed from
        // further usage (ie., cancelling pending requests with COMM_FAILURE
        // with an appropriate minor_code CompletionStatus.MAY_BE).

        // Relying on the IIOPOutputStream (as noted below) is not
        // sufficient as it handles COMM_FAILURE only for the final
        // fragment (during invoke processing). Note that COMM_FAILURE could
        // happen while sending the initial fragments.
        // Also the IIOPOutputStream does not properly close the connection.
        // It simply removes the connection from the table. An orderly
        // closure is needed (ie., cancel pending requests on the connection
        // COMM_FAILURE as well.

        // IIOPOutputStream will cleanup the connection info when it
        // sees this exception.
        SystemException exc = wrapper.writeErrorSend(e1);
        purgeCalls(exc, false, true);
        throw exc;
    }
}