Java Code Examples for com.sun.corba.se.spi.protocol.CorbaMessageMediator#getOutputObject()

The following examples show how to use com.sun.corba.se.spi.protocol.CorbaMessageMediator#getOutputObject() . 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: CorbaMessageMediatorImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void sendResponse(CorbaMessageMediator messageMediator)
{
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest: " + opAndId(messageMediator)
               + ": sending response");
    }
    // REVISIT - type and location
    CDROutputObject outputObject = (CDROutputObject)
        messageMediator.getOutputObject();
    if (outputObject != null) {
        // REVISIT - can be null for TRANSIENT below.
        outputObject.finishSendingMessage();
    }
}
 
Example 2
Source File: CorbaServerRequestDispatcherImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected CorbaMessageMediator handleDynamicResult(
    ServerRequestImpl sreq,
    CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult->: " + opAndId(req));
        }

        CorbaMessageMediator response = null ;

        // Check if ServerRequestImpl.result() has been called
        Any excany = sreq.checkResultCalled();

        if (excany == null) { // normal return
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling normal result");
            }

            // Marshal out/inout/return parameters into the ReplyMessage
            response = sendingReply(req);
            OutputStream os = (OutputStream) response.getOutputObject();
            sreq.marshalReplyParams(os);
        }  else {
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling error");
            }

            response = sendingReply(req, excany);
        }

        return response ;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult<-: " + opAndId(req));
        }
    }
}
 
Example 3
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk8u 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 4
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void sendResponse(CorbaMessageMediator messageMediator)
{
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest: " + opAndId(messageMediator)
               + ": sending response");
    }
    // REVISIT - type and location
    CDROutputObject outputObject = (CDROutputObject)
        messageMediator.getOutputObject();
    if (outputObject != null) {
        // REVISIT - can be null for TRANSIENT below.
        outputObject.finishSendingMessage();
    }
}
 
Example 5
Source File: CorbaServerRequestDispatcherImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
protected CorbaMessageMediator handleDynamicResult(
    ServerRequestImpl sreq,
    CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult->: " + opAndId(req));
        }

        CorbaMessageMediator response = null ;

        // Check if ServerRequestImpl.result() has been called
        Any excany = sreq.checkResultCalled();

        if (excany == null) { // normal return
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling normal result");
            }

            // Marshal out/inout/return parameters into the ReplyMessage
            response = sendingReply(req);
            OutputStream os = (OutputStream) response.getOutputObject();
            sreq.marshalReplyParams(os);
        }  else {
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling error");
            }

            response = sendingReply(req, excany);
        }

        return response ;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult<-: " + opAndId(req));
        }
    }
}
 
Example 6
Source File: CorbaMessageMediatorImpl.java    From JDKSourceCode1.8 with MIT License 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 7
Source File: CorbaServerRequestDispatcherImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected CorbaMessageMediator handleDynamicResult(
    ServerRequestImpl sreq,
    CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult->: " + opAndId(req));
        }

        CorbaMessageMediator response = null ;

        // Check if ServerRequestImpl.result() has been called
        Any excany = sreq.checkResultCalled();

        if (excany == null) { // normal return
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling normal result");
            }

            // Marshal out/inout/return parameters into the ReplyMessage
            response = sendingReply(req);
            OutputStream os = (OutputStream) response.getOutputObject();
            sreq.marshalReplyParams(os);
        }  else {
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling error");
            }

            response = sendingReply(req, excany);
        }

        return response ;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult<-: " + opAndId(req));
        }
    }
}
 
Example 8
Source File: CorbaMessageMediatorImpl.java    From jdk8u60 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 9
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 10
Source File: CorbaServerRequestDispatcherImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected CorbaMessageMediator handleDynamicResult(
    ServerRequestImpl sreq,
    CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult->: " + opAndId(req));
        }

        CorbaMessageMediator response = null ;

        // Check if ServerRequestImpl.result() has been called
        Any excany = sreq.checkResultCalled();

        if (excany == null) { // normal return
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling normal result");
            }

            // Marshal out/inout/return parameters into the ReplyMessage
            response = sendingReply(req);
            OutputStream os = (OutputStream) response.getOutputObject();
            sreq.marshalReplyParams(os);
        }  else {
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling error");
            }

            response = sendingReply(req, excany);
        }

        return response ;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult<-: " + opAndId(req));
        }
    }
}
 
Example 11
Source File: CorbaServerRequestDispatcherImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected CorbaMessageMediator handleDynamicResult(
    ServerRequestImpl sreq,
    CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult->: " + opAndId(req));
        }

        CorbaMessageMediator response = null ;

        // Check if ServerRequestImpl.result() has been called
        Any excany = sreq.checkResultCalled();

        if (excany == null) { // normal return
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling normal result");
            }

            // Marshal out/inout/return parameters into the ReplyMessage
            response = sendingReply(req);
            OutputStream os = (OutputStream) response.getOutputObject();
            sreq.marshalReplyParams(os);
        }  else {
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling error");
            }

            response = sendingReply(req, excany);
        }

        return response ;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult<-: " + opAndId(req));
        }
    }
}
 
Example 12
Source File: CorbaMessageMediatorImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void sendResponse(CorbaMessageMediator messageMediator)
{
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest: " + opAndId(messageMediator)
               + ": sending response");
    }
    // REVISIT - type and location
    CDROutputObject outputObject = (CDROutputObject)
        messageMediator.getOutputObject();
    if (outputObject != null) {
        // REVISIT - can be null for TRANSIENT below.
        outputObject.finishSendingMessage();
    }
}
 
Example 13
Source File: CorbaMessageMediatorImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void sendResponse(CorbaMessageMediator messageMediator)
{
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest: " + opAndId(messageMediator)
               + ": sending response");
    }
    // REVISIT - type and location
    CDROutputObject outputObject = (CDROutputObject)
        messageMediator.getOutputObject();
    if (outputObject != null) {
        // REVISIT - can be null for TRANSIENT below.
        outputObject.finishSendingMessage();
    }
}
 
Example 14
Source File: CorbaMessageMediatorImpl.java    From openjdk-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 15
Source File: CorbaMessageMediatorImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private void sendResponse(CorbaMessageMediator messageMediator)
{
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest: " + opAndId(messageMediator)
               + ": sending response");
    }
    // REVISIT - type and location
    CDROutputObject outputObject = (CDROutputObject)
        messageMediator.getOutputObject();
    if (outputObject != null) {
        // REVISIT - can be null for TRANSIENT below.
        outputObject.finishSendingMessage();
    }
}
 
Example 16
Source File: CorbaServerRequestDispatcherImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/** Must always be called, just after the servant's method returns.
 *  Creates the ReplyMessage header and puts in the transaction context
 *  if necessary.
 */
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);

        // Check if the servant set a SystemException or
        // UserException
        CorbaMessageMediator resp;
        String repId=null;
        try {
            repId = excany.type().id();
        } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
            throw wrapper.problemWithExceptionTypecode( e ) ;
        }

        if (ORBUtility.isSystemException(repId)) {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling system exception");
            }

            // Get the exception object from the Any
            InputStream in = excany.create_input_stream();
            SystemException ex = ORBUtility.readSystemException(in);
            // Marshal the exception back
            resp = req.getProtocolHandler()
                .createSystemExceptionResponse(req, ex, scs);
        } else {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling user exception");
            }

            resp = req.getProtocolHandler()
                .createUserExceptionResponse(req, scs);
            OutputStream os = (OutputStream)resp.getOutputObject();
            excany.write_value(os);
        }

        return resp;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any<-: " + opAndId(req));
        }
    }
}
 
Example 17
Source File: CorbaServerRequestDispatcherImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/** Must always be called, just after the servant's method returns.
 *  Creates the ReplyMessage header and puts in the transaction context
 *  if necessary.
 */
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);

        // Check if the servant set a SystemException or
        // UserException
        CorbaMessageMediator resp;
        String repId=null;
        try {
            repId = excany.type().id();
        } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
            throw wrapper.problemWithExceptionTypecode( e ) ;
        }

        if (ORBUtility.isSystemException(repId)) {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling system exception");
            }

            // Get the exception object from the Any
            InputStream in = excany.create_input_stream();
            SystemException ex = ORBUtility.readSystemException(in);
            // Marshal the exception back
            resp = req.getProtocolHandler()
                .createSystemExceptionResponse(req, ex, scs);
        } else {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling user exception");
            }

            resp = req.getProtocolHandler()
                .createUserExceptionResponse(req, scs);
            OutputStream os = (OutputStream)resp.getOutputObject();
            excany.write_value(os);
        }

        return resp;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any<-: " + opAndId(req));
        }
    }
}
 
Example 18
Source File: CorbaServerRequestDispatcherImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/** Must always be called, just after the servant's method returns.
 *  Creates the ReplyMessage header and puts in the transaction context
 *  if necessary.
 */
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);

        // Check if the servant set a SystemException or
        // UserException
        CorbaMessageMediator resp;
        String repId=null;
        try {
            repId = excany.type().id();
        } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
            throw wrapper.problemWithExceptionTypecode( e ) ;
        }

        if (ORBUtility.isSystemException(repId)) {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling system exception");
            }

            // Get the exception object from the Any
            InputStream in = excany.create_input_stream();
            SystemException ex = ORBUtility.readSystemException(in);
            // Marshal the exception back
            resp = req.getProtocolHandler()
                .createSystemExceptionResponse(req, ex, scs);
        } else {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling user exception");
            }

            resp = req.getProtocolHandler()
                .createUserExceptionResponse(req, scs);
            OutputStream os = (OutputStream)resp.getOutputObject();
            excany.write_value(os);
        }

        return resp;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any<-: " + opAndId(req));
        }
    }
}
 
Example 19
Source File: CorbaServerRequestDispatcherImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/** Must always be called, just after the servant's method returns.
 *  Creates the ReplyMessage header and puts in the transaction context
 *  if necessary.
 */
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);

        // Check if the servant set a SystemException or
        // UserException
        CorbaMessageMediator resp;
        String repId=null;
        try {
            repId = excany.type().id();
        } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
            throw wrapper.problemWithExceptionTypecode( e ) ;
        }

        if (ORBUtility.isSystemException(repId)) {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling system exception");
            }

            // Get the exception object from the Any
            InputStream in = excany.create_input_stream();
            SystemException ex = ORBUtility.readSystemException(in);
            // Marshal the exception back
            resp = req.getProtocolHandler()
                .createSystemExceptionResponse(req, ex, scs);
        } else {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling user exception");
            }

            resp = req.getProtocolHandler()
                .createUserExceptionResponse(req, scs);
            OutputStream os = (OutputStream)resp.getOutputObject();
            excany.write_value(os);
        }

        return resp;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any<-: " + opAndId(req));
        }
    }
}
 
Example 20
Source File: CorbaServerRequestDispatcherImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/** Must always be called, just after the servant's method returns.
 *  Creates the ReplyMessage header and puts in the transaction context
 *  if necessary.
 */
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);

        // Check if the servant set a SystemException or
        // UserException
        CorbaMessageMediator resp;
        String repId=null;
        try {
            repId = excany.type().id();
        } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
            throw wrapper.problemWithExceptionTypecode( e ) ;
        }

        if (ORBUtility.isSystemException(repId)) {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling system exception");
            }

            // Get the exception object from the Any
            InputStream in = excany.create_input_stream();
            SystemException ex = ORBUtility.readSystemException(in);
            // Marshal the exception back
            resp = req.getProtocolHandler()
                .createSystemExceptionResponse(req, ex, scs);
        } else {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling user exception");
            }

            resp = req.getProtocolHandler()
                .createUserExceptionResponse(req, scs);
            OutputStream os = (OutputStream)resp.getOutputObject();
            excany.write_value(os);
        }

        return resp;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any<-: " + opAndId(req));
        }
    }
}