Java Code Examples for com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage#getReplyStatus()

The following examples show how to use com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage#getReplyStatus() . 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: PIHandlerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
{
    if( !hasServerInterceptors ) return;
    ServerRequestInfoImpl info = peekServerRequestInfoImplStack();

    // REVISIT: This needs to be done "early" for the following workaround.
    info.setReplyMessage( replyMessage );

    // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
    // but needs to be here for now.  See comment in that method for why.
    info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );

    // It is possible we might have entered this method more than
    // once (e.g. if an ending point threw a SystemException, then
    // a new ServerResponseImpl is created).
    if( !info.getAlreadyExecuted() ) {
        int replyStatus = replyMessage.getReplyStatus();

        // Translate ReplyMessage.replyStatus into PI replyStatus:
        // Note: this is also an assertion to make sure a valid
        // replyStatus is passed in (IndexOutOfBoundsException will be
        // thrown otherwise)
        short piReplyStatus =
            REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];

        // Make forwarded IOR available to interceptors, if applicable:
        if( ( piReplyStatus == LOCATION_FORWARD.value ) ||
            ( piReplyStatus == TRANSPORT_RETRY.value ) )
        {
            info.setForwardRequest( replyMessage.getIOR() );
        }

        // REVISIT: Do early above for now.
        // Make reply message available to interceptors:
        //info.setReplyMessage( replyMessage );

        // Remember exception so we can tell if an interceptor changed it.
        Exception prevException = info.getException();

        // _REVISIT_ We do not have access to the User Exception at
        // this point, so treat it as an UNKNOWN for now.
        // Note that if this is a DSI call, we do have the user exception.
        if( !info.isDynamic() &&
            (piReplyStatus == USER_EXCEPTION.value) )
        {
            info.setException( omgWrapper.unknownUserException(
                CompletionStatus.COMPLETED_MAYBE ) ) ;
        }

        // Invoke the ending interception points:
        info.setReplyStatus( piReplyStatus );
        interceptorInvoker.invokeServerInterceptorEndingPoint( info );
        short newPIReplyStatus = info.getReplyStatus();
        Exception newException = info.getException();

        // Check reply status.  If an interceptor threw a SystemException
        // and it is different than the one that we came in with,
        // rethrow it so the proper response can be constructed:
        if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) &&
            ( newException != prevException ) )
        {
            throw (SystemException)newException;
        }

        // If we are to forward the location:
        if( newPIReplyStatus == LOCATION_FORWARD.value ) {
            if( piReplyStatus != LOCATION_FORWARD.value ) {
                // Treat a ForwardRequest as a ForwardException.
                IOR ior = info.getForwardRequestIOR();
                throw new ForwardException( orb, ior ) ;
            }
            else if( info.isForwardRequestRaisedInEnding() ) {
                // Treat a ForwardRequest by changing the IOR.
                replyMessage.setIOR( info.getForwardRequestIOR() );
            }
        }
    }
}
 
Example 2
Source File: PIHandlerImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
{
    if( !hasServerInterceptors ) return;
    ServerRequestInfoImpl info = peekServerRequestInfoImplStack();

    // REVISIT: This needs to be done "early" for the following workaround.
    info.setReplyMessage( replyMessage );

    // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
    // but needs to be here for now.  See comment in that method for why.
    info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );

    // It is possible we might have entered this method more than
    // once (e.g. if an ending point threw a SystemException, then
    // a new ServerResponseImpl is created).
    if( !info.getAlreadyExecuted() ) {
        int replyStatus = replyMessage.getReplyStatus();

        // Translate ReplyMessage.replyStatus into PI replyStatus:
        // Note: this is also an assertion to make sure a valid
        // replyStatus is passed in (IndexOutOfBoundsException will be
        // thrown otherwise)
        short piReplyStatus =
            REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];

        // Make forwarded IOR available to interceptors, if applicable:
        if( ( piReplyStatus == LOCATION_FORWARD.value ) ||
            ( piReplyStatus == TRANSPORT_RETRY.value ) )
        {
            info.setForwardRequest( replyMessage.getIOR() );
        }

        // REVISIT: Do early above for now.
        // Make reply message available to interceptors:
        //info.setReplyMessage( replyMessage );

        // Remember exception so we can tell if an interceptor changed it.
        Exception prevException = info.getException();

        // _REVISIT_ We do not have access to the User Exception at
        // this point, so treat it as an UNKNOWN for now.
        // Note that if this is a DSI call, we do have the user exception.
        if( !info.isDynamic() &&
            (piReplyStatus == USER_EXCEPTION.value) )
        {
            info.setException( omgWrapper.unknownUserException(
                CompletionStatus.COMPLETED_MAYBE ) ) ;
        }

        // Invoke the ending interception points:
        info.setReplyStatus( piReplyStatus );
        interceptorInvoker.invokeServerInterceptorEndingPoint( info );
        short newPIReplyStatus = info.getReplyStatus();
        Exception newException = info.getException();

        // Check reply status.  If an interceptor threw a SystemException
        // and it is different than the one that we came in with,
        // rethrow it so the proper response can be constructed:
        if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) &&
            ( newException != prevException ) )
        {
            throw (SystemException)newException;
        }

        // If we are to forward the location:
        if( newPIReplyStatus == LOCATION_FORWARD.value ) {
            if( piReplyStatus != LOCATION_FORWARD.value ) {
                // Treat a ForwardRequest as a ForwardException.
                IOR ior = info.getForwardRequestIOR();
                throw new ForwardException( orb, ior ) ;
            }
            else if( info.isForwardRequestRaisedInEnding() ) {
                // Treat a ForwardRequest by changing the IOR.
                replyMessage.setIOR( info.getForwardRequestIOR() );
            }
        }
    }
}
 
Example 3
Source File: PIHandlerImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
{
    if( !hasServerInterceptors ) return;
    ServerRequestInfoImpl info = peekServerRequestInfoImplStack();

    // REVISIT: This needs to be done "early" for the following workaround.
    info.setReplyMessage( replyMessage );

    // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
    // but needs to be here for now.  See comment in that method for why.
    info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );

    // It is possible we might have entered this method more than
    // once (e.g. if an ending point threw a SystemException, then
    // a new ServerResponseImpl is created).
    if( !info.getAlreadyExecuted() ) {
        int replyStatus = replyMessage.getReplyStatus();

        // Translate ReplyMessage.replyStatus into PI replyStatus:
        // Note: this is also an assertion to make sure a valid
        // replyStatus is passed in (IndexOutOfBoundsException will be
        // thrown otherwise)
        short piReplyStatus =
            REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];

        // Make forwarded IOR available to interceptors, if applicable:
        if( ( piReplyStatus == LOCATION_FORWARD.value ) ||
            ( piReplyStatus == TRANSPORT_RETRY.value ) )
        {
            info.setForwardRequest( replyMessage.getIOR() );
        }

        // REVISIT: Do early above for now.
        // Make reply message available to interceptors:
        //info.setReplyMessage( replyMessage );

        // Remember exception so we can tell if an interceptor changed it.
        Exception prevException = info.getException();

        // _REVISIT_ We do not have access to the User Exception at
        // this point, so treat it as an UNKNOWN for now.
        // Note that if this is a DSI call, we do have the user exception.
        if( !info.isDynamic() &&
            (piReplyStatus == USER_EXCEPTION.value) )
        {
            info.setException( omgWrapper.unknownUserException(
                CompletionStatus.COMPLETED_MAYBE ) ) ;
        }

        // Invoke the ending interception points:
        info.setReplyStatus( piReplyStatus );
        interceptorInvoker.invokeServerInterceptorEndingPoint( info );
        short newPIReplyStatus = info.getReplyStatus();
        Exception newException = info.getException();

        // Check reply status.  If an interceptor threw a SystemException
        // and it is different than the one that we came in with,
        // rethrow it so the proper response can be constructed:
        if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) &&
            ( newException != prevException ) )
        {
            throw (SystemException)newException;
        }

        // If we are to forward the location:
        if( newPIReplyStatus == LOCATION_FORWARD.value ) {
            if( piReplyStatus != LOCATION_FORWARD.value ) {
                // Treat a ForwardRequest as a ForwardException.
                IOR ior = info.getForwardRequestIOR();
                throw new ForwardException( orb, ior ) ;
            }
            else if( info.isForwardRequestRaisedInEnding() ) {
                // Treat a ForwardRequest by changing the IOR.
                replyMessage.setIOR( info.getForwardRequestIOR() );
            }
        }
    }
}
 
Example 4
Source File: PIHandlerImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
{
    if( !hasServerInterceptors ) return;
    ServerRequestInfoImpl info = peekServerRequestInfoImplStack();

    // REVISIT: This needs to be done "early" for the following workaround.
    info.setReplyMessage( replyMessage );

    // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
    // but needs to be here for now.  See comment in that method for why.
    info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );

    // It is possible we might have entered this method more than
    // once (e.g. if an ending point threw a SystemException, then
    // a new ServerResponseImpl is created).
    if( !info.getAlreadyExecuted() ) {
        int replyStatus = replyMessage.getReplyStatus();

        // Translate ReplyMessage.replyStatus into PI replyStatus:
        // Note: this is also an assertion to make sure a valid
        // replyStatus is passed in (IndexOutOfBoundsException will be
        // thrown otherwise)
        short piReplyStatus =
            REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];

        // Make forwarded IOR available to interceptors, if applicable:
        if( ( piReplyStatus == LOCATION_FORWARD.value ) ||
            ( piReplyStatus == TRANSPORT_RETRY.value ) )
        {
            info.setForwardRequest( replyMessage.getIOR() );
        }

        // REVISIT: Do early above for now.
        // Make reply message available to interceptors:
        //info.setReplyMessage( replyMessage );

        // Remember exception so we can tell if an interceptor changed it.
        Exception prevException = info.getException();

        // _REVISIT_ We do not have access to the User Exception at
        // this point, so treat it as an UNKNOWN for now.
        // Note that if this is a DSI call, we do have the user exception.
        if( !info.isDynamic() &&
            (piReplyStatus == USER_EXCEPTION.value) )
        {
            info.setException( omgWrapper.unknownUserException(
                CompletionStatus.COMPLETED_MAYBE ) ) ;
        }

        // Invoke the ending interception points:
        info.setReplyStatus( piReplyStatus );
        interceptorInvoker.invokeServerInterceptorEndingPoint( info );
        short newPIReplyStatus = info.getReplyStatus();
        Exception newException = info.getException();

        // Check reply status.  If an interceptor threw a SystemException
        // and it is different than the one that we came in with,
        // rethrow it so the proper response can be constructed:
        if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) &&
            ( newException != prevException ) )
        {
            throw (SystemException)newException;
        }

        // If we are to forward the location:
        if( newPIReplyStatus == LOCATION_FORWARD.value ) {
            if( piReplyStatus != LOCATION_FORWARD.value ) {
                // Treat a ForwardRequest as a ForwardException.
                IOR ior = info.getForwardRequestIOR();
                throw new ForwardException( orb, ior ) ;
            }
            else if( info.isForwardRequestRaisedInEnding() ) {
                // Treat a ForwardRequest by changing the IOR.
                replyMessage.setIOR( info.getForwardRequestIOR() );
            }
        }
    }
}
 
Example 5
Source File: PIHandlerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
{
    if( !hasServerInterceptors ) return;
    ServerRequestInfoImpl info = peekServerRequestInfoImplStack();

    // REVISIT: This needs to be done "early" for the following workaround.
    info.setReplyMessage( replyMessage );

    // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
    // but needs to be here for now.  See comment in that method for why.
    info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );

    // It is possible we might have entered this method more than
    // once (e.g. if an ending point threw a SystemException, then
    // a new ServerResponseImpl is created).
    if( !info.getAlreadyExecuted() ) {
        int replyStatus = replyMessage.getReplyStatus();

        // Translate ReplyMessage.replyStatus into PI replyStatus:
        // Note: this is also an assertion to make sure a valid
        // replyStatus is passed in (IndexOutOfBoundsException will be
        // thrown otherwise)
        short piReplyStatus =
            REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];

        // Make forwarded IOR available to interceptors, if applicable:
        if( ( piReplyStatus == LOCATION_FORWARD.value ) ||
            ( piReplyStatus == TRANSPORT_RETRY.value ) )
        {
            info.setForwardRequest( replyMessage.getIOR() );
        }

        // REVISIT: Do early above for now.
        // Make reply message available to interceptors:
        //info.setReplyMessage( replyMessage );

        // Remember exception so we can tell if an interceptor changed it.
        Exception prevException = info.getException();

        // _REVISIT_ We do not have access to the User Exception at
        // this point, so treat it as an UNKNOWN for now.
        // Note that if this is a DSI call, we do have the user exception.
        if( !info.isDynamic() &&
            (piReplyStatus == USER_EXCEPTION.value) )
        {
            info.setException( omgWrapper.unknownUserException(
                CompletionStatus.COMPLETED_MAYBE ) ) ;
        }

        // Invoke the ending interception points:
        info.setReplyStatus( piReplyStatus );
        interceptorInvoker.invokeServerInterceptorEndingPoint( info );
        short newPIReplyStatus = info.getReplyStatus();
        Exception newException = info.getException();

        // Check reply status.  If an interceptor threw a SystemException
        // and it is different than the one that we came in with,
        // rethrow it so the proper response can be constructed:
        if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) &&
            ( newException != prevException ) )
        {
            throw (SystemException)newException;
        }

        // If we are to forward the location:
        if( newPIReplyStatus == LOCATION_FORWARD.value ) {
            if( piReplyStatus != LOCATION_FORWARD.value ) {
                // Treat a ForwardRequest as a ForwardException.
                IOR ior = info.getForwardRequestIOR();
                throw new ForwardException( orb, ior ) ;
            }
            else if( info.isForwardRequestRaisedInEnding() ) {
                // Treat a ForwardRequest by changing the IOR.
                replyMessage.setIOR( info.getForwardRequestIOR() );
            }
        }
    }
}
 
Example 6
Source File: PIHandlerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
{
    if( !hasServerInterceptors ) return;
    ServerRequestInfoImpl info = peekServerRequestInfoImplStack();

    // REVISIT: This needs to be done "early" for the following workaround.
    info.setReplyMessage( replyMessage );

    // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
    // but needs to be here for now.  See comment in that method for why.
    info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );

    // It is possible we might have entered this method more than
    // once (e.g. if an ending point threw a SystemException, then
    // a new ServerResponseImpl is created).
    if( !info.getAlreadyExecuted() ) {
        int replyStatus = replyMessage.getReplyStatus();

        // Translate ReplyMessage.replyStatus into PI replyStatus:
        // Note: this is also an assertion to make sure a valid
        // replyStatus is passed in (IndexOutOfBoundsException will be
        // thrown otherwise)
        short piReplyStatus =
            REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];

        // Make forwarded IOR available to interceptors, if applicable:
        if( ( piReplyStatus == LOCATION_FORWARD.value ) ||
            ( piReplyStatus == TRANSPORT_RETRY.value ) )
        {
            info.setForwardRequest( replyMessage.getIOR() );
        }

        // REVISIT: Do early above for now.
        // Make reply message available to interceptors:
        //info.setReplyMessage( replyMessage );

        // Remember exception so we can tell if an interceptor changed it.
        Exception prevException = info.getException();

        // _REVISIT_ We do not have access to the User Exception at
        // this point, so treat it as an UNKNOWN for now.
        // Note that if this is a DSI call, we do have the user exception.
        if( !info.isDynamic() &&
            (piReplyStatus == USER_EXCEPTION.value) )
        {
            info.setException( omgWrapper.unknownUserException(
                CompletionStatus.COMPLETED_MAYBE ) ) ;
        }

        // Invoke the ending interception points:
        info.setReplyStatus( piReplyStatus );
        interceptorInvoker.invokeServerInterceptorEndingPoint( info );
        short newPIReplyStatus = info.getReplyStatus();
        Exception newException = info.getException();

        // Check reply status.  If an interceptor threw a SystemException
        // and it is different than the one that we came in with,
        // rethrow it so the proper response can be constructed:
        if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) &&
            ( newException != prevException ) )
        {
            throw (SystemException)newException;
        }

        // If we are to forward the location:
        if( newPIReplyStatus == LOCATION_FORWARD.value ) {
            if( piReplyStatus != LOCATION_FORWARD.value ) {
                // Treat a ForwardRequest as a ForwardException.
                IOR ior = info.getForwardRequestIOR();
                throw new ForwardException( orb, ior ) ;
            }
            else if( info.isForwardRequestRaisedInEnding() ) {
                // Treat a ForwardRequest by changing the IOR.
                replyMessage.setIOR( info.getForwardRequestIOR() );
            }
        }
    }
}
 
Example 7
Source File: PIHandlerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
{
    if( !hasServerInterceptors ) return;
    ServerRequestInfoImpl info = peekServerRequestInfoImplStack();

    // REVISIT: This needs to be done "early" for the following workaround.
    info.setReplyMessage( replyMessage );

    // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
    // but needs to be here for now.  See comment in that method for why.
    info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );

    // It is possible we might have entered this method more than
    // once (e.g. if an ending point threw a SystemException, then
    // a new ServerResponseImpl is created).
    if( !info.getAlreadyExecuted() ) {
        int replyStatus = replyMessage.getReplyStatus();

        // Translate ReplyMessage.replyStatus into PI replyStatus:
        // Note: this is also an assertion to make sure a valid
        // replyStatus is passed in (IndexOutOfBoundsException will be
        // thrown otherwise)
        short piReplyStatus =
            REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];

        // Make forwarded IOR available to interceptors, if applicable:
        if( ( piReplyStatus == LOCATION_FORWARD.value ) ||
            ( piReplyStatus == TRANSPORT_RETRY.value ) )
        {
            info.setForwardRequest( replyMessage.getIOR() );
        }

        // REVISIT: Do early above for now.
        // Make reply message available to interceptors:
        //info.setReplyMessage( replyMessage );

        // Remember exception so we can tell if an interceptor changed it.
        Exception prevException = info.getException();

        // _REVISIT_ We do not have access to the User Exception at
        // this point, so treat it as an UNKNOWN for now.
        // Note that if this is a DSI call, we do have the user exception.
        if( !info.isDynamic() &&
            (piReplyStatus == USER_EXCEPTION.value) )
        {
            info.setException( omgWrapper.unknownUserException(
                CompletionStatus.COMPLETED_MAYBE ) ) ;
        }

        // Invoke the ending interception points:
        info.setReplyStatus( piReplyStatus );
        interceptorInvoker.invokeServerInterceptorEndingPoint( info );
        short newPIReplyStatus = info.getReplyStatus();
        Exception newException = info.getException();

        // Check reply status.  If an interceptor threw a SystemException
        // and it is different than the one that we came in with,
        // rethrow it so the proper response can be constructed:
        if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) &&
            ( newException != prevException ) )
        {
            throw (SystemException)newException;
        }

        // If we are to forward the location:
        if( newPIReplyStatus == LOCATION_FORWARD.value ) {
            if( piReplyStatus != LOCATION_FORWARD.value ) {
                // Treat a ForwardRequest as a ForwardException.
                IOR ior = info.getForwardRequestIOR();
                throw new ForwardException( orb, ior ) ;
            }
            else if( info.isForwardRequestRaisedInEnding() ) {
                // Treat a ForwardRequest by changing the IOR.
                replyMessage.setIOR( info.getForwardRequestIOR() );
            }
        }
    }
}
 
Example 8
Source File: PIHandlerImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
{
    if( !hasServerInterceptors ) return;
    ServerRequestInfoImpl info = peekServerRequestInfoImplStack();

    // REVISIT: This needs to be done "early" for the following workaround.
    info.setReplyMessage( replyMessage );

    // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
    // but needs to be here for now.  See comment in that method for why.
    info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );

    // It is possible we might have entered this method more than
    // once (e.g. if an ending point threw a SystemException, then
    // a new ServerResponseImpl is created).
    if( !info.getAlreadyExecuted() ) {
        int replyStatus = replyMessage.getReplyStatus();

        // Translate ReplyMessage.replyStatus into PI replyStatus:
        // Note: this is also an assertion to make sure a valid
        // replyStatus is passed in (IndexOutOfBoundsException will be
        // thrown otherwise)
        short piReplyStatus =
            REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];

        // Make forwarded IOR available to interceptors, if applicable:
        if( ( piReplyStatus == LOCATION_FORWARD.value ) ||
            ( piReplyStatus == TRANSPORT_RETRY.value ) )
        {
            info.setForwardRequest( replyMessage.getIOR() );
        }

        // REVISIT: Do early above for now.
        // Make reply message available to interceptors:
        //info.setReplyMessage( replyMessage );

        // Remember exception so we can tell if an interceptor changed it.
        Exception prevException = info.getException();

        // _REVISIT_ We do not have access to the User Exception at
        // this point, so treat it as an UNKNOWN for now.
        // Note that if this is a DSI call, we do have the user exception.
        if( !info.isDynamic() &&
            (piReplyStatus == USER_EXCEPTION.value) )
        {
            info.setException( omgWrapper.unknownUserException(
                CompletionStatus.COMPLETED_MAYBE ) ) ;
        }

        // Invoke the ending interception points:
        info.setReplyStatus( piReplyStatus );
        interceptorInvoker.invokeServerInterceptorEndingPoint( info );
        short newPIReplyStatus = info.getReplyStatus();
        Exception newException = info.getException();

        // Check reply status.  If an interceptor threw a SystemException
        // and it is different than the one that we came in with,
        // rethrow it so the proper response can be constructed:
        if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) &&
            ( newException != prevException ) )
        {
            throw (SystemException)newException;
        }

        // If we are to forward the location:
        if( newPIReplyStatus == LOCATION_FORWARD.value ) {
            if( piReplyStatus != LOCATION_FORWARD.value ) {
                // Treat a ForwardRequest as a ForwardException.
                IOR ior = info.getForwardRequestIOR();
                throw new ForwardException( orb, ior ) ;
            }
            else if( info.isForwardRequestRaisedInEnding() ) {
                // Treat a ForwardRequest by changing the IOR.
                replyMessage.setIOR( info.getForwardRequestIOR() );
            }
        }
    }
}
 
Example 9
Source File: PIHandlerImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
{
    if( !hasServerInterceptors ) return;
    ServerRequestInfoImpl info = peekServerRequestInfoImplStack();

    // REVISIT: This needs to be done "early" for the following workaround.
    info.setReplyMessage( replyMessage );

    // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
    // but needs to be here for now.  See comment in that method for why.
    info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );

    // It is possible we might have entered this method more than
    // once (e.g. if an ending point threw a SystemException, then
    // a new ServerResponseImpl is created).
    if( !info.getAlreadyExecuted() ) {
        int replyStatus = replyMessage.getReplyStatus();

        // Translate ReplyMessage.replyStatus into PI replyStatus:
        // Note: this is also an assertion to make sure a valid
        // replyStatus is passed in (IndexOutOfBoundsException will be
        // thrown otherwise)
        short piReplyStatus =
            REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];

        // Make forwarded IOR available to interceptors, if applicable:
        if( ( piReplyStatus == LOCATION_FORWARD.value ) ||
            ( piReplyStatus == TRANSPORT_RETRY.value ) )
        {
            info.setForwardRequest( replyMessage.getIOR() );
        }

        // REVISIT: Do early above for now.
        // Make reply message available to interceptors:
        //info.setReplyMessage( replyMessage );

        // Remember exception so we can tell if an interceptor changed it.
        Exception prevException = info.getException();

        // _REVISIT_ We do not have access to the User Exception at
        // this point, so treat it as an UNKNOWN for now.
        // Note that if this is a DSI call, we do have the user exception.
        if( !info.isDynamic() &&
            (piReplyStatus == USER_EXCEPTION.value) )
        {
            info.setException( omgWrapper.unknownUserException(
                CompletionStatus.COMPLETED_MAYBE ) ) ;
        }

        // Invoke the ending interception points:
        info.setReplyStatus( piReplyStatus );
        interceptorInvoker.invokeServerInterceptorEndingPoint( info );
        short newPIReplyStatus = info.getReplyStatus();
        Exception newException = info.getException();

        // Check reply status.  If an interceptor threw a SystemException
        // and it is different than the one that we came in with,
        // rethrow it so the proper response can be constructed:
        if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) &&
            ( newException != prevException ) )
        {
            throw (SystemException)newException;
        }

        // If we are to forward the location:
        if( newPIReplyStatus == LOCATION_FORWARD.value ) {
            if( piReplyStatus != LOCATION_FORWARD.value ) {
                // Treat a ForwardRequest as a ForwardException.
                IOR ior = info.getForwardRequestIOR();
                throw new ForwardException( orb, ior ) ;
            }
            else if( info.isForwardRequestRaisedInEnding() ) {
                // Treat a ForwardRequest by changing the IOR.
                replyMessage.setIOR( info.getForwardRequestIOR() );
            }
        }
    }
}
 
Example 10
Source File: PIHandlerImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
{
    if( !hasServerInterceptors ) return;
    ServerRequestInfoImpl info = peekServerRequestInfoImplStack();

    // REVISIT: This needs to be done "early" for the following workaround.
    info.setReplyMessage( replyMessage );

    // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
    // but needs to be here for now.  See comment in that method for why.
    info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );

    // It is possible we might have entered this method more than
    // once (e.g. if an ending point threw a SystemException, then
    // a new ServerResponseImpl is created).
    if( !info.getAlreadyExecuted() ) {
        int replyStatus = replyMessage.getReplyStatus();

        // Translate ReplyMessage.replyStatus into PI replyStatus:
        // Note: this is also an assertion to make sure a valid
        // replyStatus is passed in (IndexOutOfBoundsException will be
        // thrown otherwise)
        short piReplyStatus =
            REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];

        // Make forwarded IOR available to interceptors, if applicable:
        if( ( piReplyStatus == LOCATION_FORWARD.value ) ||
            ( piReplyStatus == TRANSPORT_RETRY.value ) )
        {
            info.setForwardRequest( replyMessage.getIOR() );
        }

        // REVISIT: Do early above for now.
        // Make reply message available to interceptors:
        //info.setReplyMessage( replyMessage );

        // Remember exception so we can tell if an interceptor changed it.
        Exception prevException = info.getException();

        // _REVISIT_ We do not have access to the User Exception at
        // this point, so treat it as an UNKNOWN for now.
        // Note that if this is a DSI call, we do have the user exception.
        if( !info.isDynamic() &&
            (piReplyStatus == USER_EXCEPTION.value) )
        {
            info.setException( omgWrapper.unknownUserException(
                CompletionStatus.COMPLETED_MAYBE ) ) ;
        }

        // Invoke the ending interception points:
        info.setReplyStatus( piReplyStatus );
        interceptorInvoker.invokeServerInterceptorEndingPoint( info );
        short newPIReplyStatus = info.getReplyStatus();
        Exception newException = info.getException();

        // Check reply status.  If an interceptor threw a SystemException
        // and it is different than the one that we came in with,
        // rethrow it so the proper response can be constructed:
        if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) &&
            ( newException != prevException ) )
        {
            throw (SystemException)newException;
        }

        // If we are to forward the location:
        if( newPIReplyStatus == LOCATION_FORWARD.value ) {
            if( piReplyStatus != LOCATION_FORWARD.value ) {
                // Treat a ForwardRequest as a ForwardException.
                IOR ior = info.getForwardRequestIOR();
                throw new ForwardException( orb, ior ) ;
            }
            else if( info.isForwardRequestRaisedInEnding() ) {
                // Treat a ForwardRequest by changing the IOR.
                replyMessage.setIOR( info.getForwardRequestIOR() );
            }
        }
    }
}