Package org.omg.CORBA.portable

Examples of org.omg.CORBA.portable.RemarshalException


                if( se == exception ) {
                    // exception = null is to maintain symmetry with
                    // GenericPOAClientSC.
                    exception = null;
                    continueOrThrowSystemOrRemarshal(messageMediator,
                                                     new RemarshalException());
                    throw wrapper.statementNotReachable1() ;
                } else {
                    //  Otherwise, throw the exception PI wants thrown.
                    continueOrThrowSystemOrRemarshal(messageMediator,
                                                     exception);
                    throw wrapper.statementNotReachable2() ;
                }
            }

            // No retry, so see if was unknown.

            ServiceContexts contexts =
                messageMediator.getReplyServiceContexts();
            if (contexts != null) {
                UEInfoServiceContext usc =
                    (UEInfoServiceContext)
                    contexts.get(UEInfoServiceContext.SERVICE_CONTEXT_ID);

                if (usc != null) {
                    Throwable unknown = usc.getUE() ;
                    UnknownException ue = new UnknownException(unknown);

                    // Invoke Portable Interceptors with receive_exception:
                    exception = orb.getPIHandler().invokeClientPIEndingPoint(
                        ReplyMessage.SYSTEM_EXCEPTION, ue );

                    continueOrThrowSystemOrRemarshal(messageMediator, exception);
                    throw wrapper.statementNotReachable3() ;
                }
            }

            // It was not a comm failure nor unknown.
            // This is the general case.

            // Invoke Portable Interceptors with receive_exception:
            exception = orb.getPIHandler().invokeClientPIEndingPoint(
                ReplyMessage.SYSTEM_EXCEPTION, se );

            continueOrThrowSystemOrRemarshal(messageMediator, exception);

            // Note: We should never need to execute this line, but
            // we should assert in case exception is null somehow.
            throw wrapper.statementNotReachable4() ;
        } else if (messageMediator.isUserExceptionReply()) {

            if (orb.subcontractDebugFlag) {
                dprint(".processResponse: " + opAndId(messageMediator)
                       + ": received user exception");
            }

            getContactInfoListIterator(orb)
                .reportSuccess(messageMediator.getContactInfo());

            String exceptionRepoId = peekUserExceptionId(inputObject);
            Exception newException = null;

            if (messageMediator.isDIIRequest()) {
                exception = messageMediator.unmarshalDIIUserException(
                                exceptionRepoId, (InputStream)inputObject);
                newException = orb.getPIHandler().invokeClientPIEndingPoint(
                                   ReplyMessage.USER_EXCEPTION, exception );
                messageMediator.setDIIException(newException);

            } else {
                ApplicationException appException =
                    new ApplicationException(
                        exceptionRepoId,
                        (org.omg.CORBA.portable.InputStream)inputObject);
                exception = appException;
                newException = orb.getPIHandler().invokeClientPIEndingPoint(
                                   ReplyMessage.USER_EXCEPTION, appException );
            }

            if (newException != exception) {
                continueOrThrowSystemOrRemarshal(messageMediator,newException);
            }

            if (newException instanceof ApplicationException) {
                throw (ApplicationException)newException;
            }
            // For DII:
            // This return will be ignored - already unmarshaled above.
            return inputObject;

        } else if (messageMediator.isLocationForwardReply()) {

            if (orb.subcontractDebugFlag) {
                dprint(".processResponse: " + opAndId(messageMediator)
                       + ": received location forward");
            }

            // NOTE: Expects iterator to update target IOR
            getContactInfoListIterator(orb).reportRedirect(
                (CorbaContactInfo)messageMediator.getContactInfo(),
                messageMediator.getForwardedIOR());

            // Invoke Portable Interceptors with receive_other:
            Exception newException = orb.getPIHandler().invokeClientPIEndingPoint(
                ReplyMessage.LOCATION_FORWARD, null );

            if( !(newException instanceof RemarshalException) ) {
                exception = newException;
            }

            // If PI did not change exception, throw Remarshal, else
            // throw the exception PI wants thrown.
            // KMC: GenericPOAClientSC did not check exception != null
            if( exception != null ) {
                continueOrThrowSystemOrRemarshal(messageMediator, exception);
            }
            continueOrThrowSystemOrRemarshal(messageMediator,
                                             new RemarshalException());
            throw wrapper.statementNotReachable5() ;

        } else if (messageMediator.isDifferentAddrDispositionRequestedReply()){

            if (orb.subcontractDebugFlag) {
                dprint(".processResponse: " + opAndId(messageMediator)
                       + ": received different addressing dispostion request");
            }

            // Set the desired target addressing disposition.
            getContactInfoListIterator(orb).reportAddrDispositionRetry(
                (CorbaContactInfo)messageMediator.getContactInfo(),
                messageMediator.getAddrDispositionReply());

            // Invoke Portable Interceptors with receive_other:
            Exception newException = orb.getPIHandler().invokeClientPIEndingPoint(
                ReplyMessage.NEEDS_ADDRESSING_MODE, null);

            // For consistency with corresponding code in GenericPOAClientSC:
            if( !(newException instanceof RemarshalException) ) {
                exception = newException;
            }

            // If PI did not change exception, throw Remarshal, else
            // throw the exception PI wants thrown.
            // KMC: GenericPOAClientSC did not include exception != null check
            if( exception != null ) {
                continueOrThrowSystemOrRemarshal(messageMediator, exception);
            }
            continueOrThrowSystemOrRemarshal(messageMediator,
                                             new RemarshalException());
            throw wrapper.statementNotReachable6() ;
        } else /* normal response */ {

            if (orb.subcontractDebugFlag) {
                dprint(".processResponse: " + opAndId(messageMediator)
View Full Code Here


            }
            else
            {
                info.delegate.rebind(fwd.forward );

                throw new RemarshalException();
            }
        }
        catch ( org.omg.CORBA.UserException ue )
        {
            if (logger.isWarnEnabled())
View Full Code Here

            }
            catch (org.omg.CORBA.COMM_FAILURE ex)
            {
                if (retry_on_failure)
                {
                    throw new RemarshalException();
                }
                //rethrow
                throw ex;
            }
        }
        catch ( SystemException se )
        {
            try
            {
                interceptors.handle_receive_exception( se );
            }
            catch (ForwardRequest fwd)
            {
                //should  not happen with a remote request
            }

            throw se;
        }
        catch ( RemarshalException re )
        {
            // Wait until the thread that received the actual
            // forward request rebound the Delegate
            group.waitOnBarrier();
            throw new RemarshalException();
        }

        final ReplyInputStream reply = ( ReplyInputStream ) in;

        final ReplyStatusType_1_2 status = reply.getStatus();

        switch ( status.value() )
        {
            case ReplyStatusType_1_2._NO_EXCEPTION:
            {
                try
                {
                    interceptors.handle_receive_reply ( reply );
                }
                catch (ForwardRequest fwd)
                {
                    // should not happen with a remote request
                }

                checkTimeout();
                return reply;
            }
            case ReplyStatusType_1_2._USER_EXCEPTION:
            {
                ApplicationException ae = getApplicationException ( reply );
                try
                {
                    interceptors.handle_receive_exception( ae, reply );
                }
                catch (ForwardRequest fwd)
                {
                    // should not happen with a remote request
                }

                checkTimeout();
                throw ae;
            }
            case ReplyStatusType_1_2._SYSTEM_EXCEPTION:
            {
                SystemException se = SystemExceptionHelper.read ( reply );
                try
                {
                    interceptors.handle_receive_exception( se, reply );
                }
                catch (ForwardRequest fwd)
                {
                    // should not happen with a remote request
                }

                checkTimeout();
                throw se;
            }
            case ReplyStatusType_1_2._LOCATION_FORWARD:
            case ReplyStatusType_1_2._LOCATION_FORWARD_PERM:
            {
                org.omg.CORBA.Object forward_reference = reply.read_Object();
                try
                {
                    interceptors.handle_location_forward( reply, forward_reference );
                }
                catch (ForwardRequest fwd)
                {
                    // should not happen with a remote request
                }

                checkTimeout();
                doRebind( forward_reference );
                throw new RemarshalException();
            }
            case ReplyStatusType_1_2._NEEDS_ADDRESSING_MODE:
            {
                throw new org.omg.CORBA.NO_IMPLEMENT(
                    "WARNING: Got reply status NEEDS_ADDRESSING_MODE "
View Full Code Here

               {
                    logger.debug("invoke: RemarshalException");

                    // RequestOutputStream has been created for
                    // another connection, so try again
                    throw new RemarshalException();
                }
            }

            group = getReplyGroup (connectionToUse);
            if ( !ros.response_expected() )  // oneway op
            {
                invoke_oneway (ros, connectionToUse, interceptors, group);
            }
            else
            {
                // response expected, synchronous or asynchronous
                receiver = new ReplyReceiver(this, group,
                                             ros.operation(),
                                             ros.getReplyEndTime(),
                                            interceptors, replyHandler, selectorManager);

                try
                {
                   receiver.configure(configuration);
                }
                catch (ConfigurationException ex)
                {
                   logger.error ("Configuration problem with ReplyReceiver", ex);
                   throw new INTERNAL ("Caught configuration exception setting up ReplyReceiver.");
                }

                group.addHolder (receiver);

                // Use the local copy of the client connection to avoid trouble
                // with something else affecting the real connections[currentConnection].
                connectionToUse.sendRequest(ros, receiver, ros.requestId(), true);
                getParsedIOR ().markLastUsedProfile ();
            }
        }
        catch ( org.omg.CORBA.SystemException cfe )
        {
            logger.debug("invoke[-->]: SystemException", cfe);

            if( !async )
            {
                // Remove ReplyReceiver to break up reference cycle
                // Otherwise gc will not detect this Delegate and
                // will never finalize it.
                if (group != null)
                    group.removeHolder(receiver);
            }

            try
            {
                interceptors.handle_receive_exception ( cfe );
            }
            catch (ForwardRequest fwd)
            {
                // Should not happen for remote requests
            }

            // The exception is a TRANSIENT, so try rebinding.
            if ( cfe instanceof org.omg.CORBA.TRANSIENT && try_rebind (false))
            {
                throw new RemarshalException();
            }

            if (!(cfe instanceof org.omg.CORBA.TIMEOUT))
            {
                if (logger.isDebugEnabled())
                {
                    logger.debug (this.toString() + " : invoke_internal: closing connection due to " + cfe.getMessage());
                }
                disconnect(connectionToUse);
            }

            throw cfe;
        }
        finally
        {
            if (orb.hasRequestInterceptors())
            {
                localInterceptors.set(null);
            }
        }

        try
        {
            if ( !async && receiver != null )
            {
                // Synchronous invocation, response expected.
                // This call blocks until the reply arrives.
                org.omg.CORBA.portable.InputStream is = receiver.getReply();

                ((CDRInputStream)is).updateMutatorConnection (connectionToUse.getGIOPConnection());

                if (clearCurrentContext)
                {
                    clearInvocationContext();
                }

                return is;
            }
        }
        catch(SystemException e)
        {
            logger.debug("invoke[<--]: SystemException", e);


            // An Object Not Exist on a forwarded reference should retry
            // on the original to get forwarded again to the right server
            if ( e instanceof org.omg.CORBA.OBJECT_NOT_EXIST && try_rebind (true))
            {
                throw new RemarshalException();
            }

            // If the attempt to read the reply throws a system exception its
            // possible that the pending_replies will not get cleaned up.
            if (group != null)
View Full Code Here

            intercept_iter.iterate( info, op );
        }
        catch (ForwardRequest fwd )
        {
            rebind(fwd.forward);
            throw new RemarshalException();
        }
        catch ( org.omg.CORBA.UserException ue )
        {
            if (logger.isErrorEnabled())
            {
View Full Code Here

                    ReplyMessage.SYSTEM_EXCEPTION, e);

            if (retry) {
                if (newException == e) {
                    continueOrThrowSystemOrRemarshal(messageMediator,
                                                     new RemarshalException());
                } else {
                    continueOrThrowSystemOrRemarshal(messageMediator,
                                                     newException);
                }
            } else {
View Full Code Here

                if( se == exception ) {
                    // exception = null is to maintain symmetry with
                    // GenericPOAClientSC.
                    exception = null;
                    continueOrThrowSystemOrRemarshal(messageMediator,
                                                     new RemarshalException());
                    throw wrapper.statementNotReachable1() ;
                } else {
                    //  Otherwise, throw the exception PI wants thrown.
                    continueOrThrowSystemOrRemarshal(messageMediator,
                                                     exception);
                    throw wrapper.statementNotReachable2() ;
                }
            }

            // No retry, so see if was unknown.

            ServiceContexts contexts =
                messageMediator.getReplyServiceContexts();
            if (contexts != null) {
                UEInfoServiceContext usc =
                    (UEInfoServiceContext)
                    contexts.get(UEInfoServiceContext.SERVICE_CONTEXT_ID);

                if (usc != null) {
                    Throwable unknown = usc.getUE() ;
                    UnknownException ue = new UnknownException(unknown);

                    // Invoke Portable Interceptors with receive_exception:
                    exception = orb.getPIHandler().invokeClientPIEndingPoint(
                        ReplyMessage.SYSTEM_EXCEPTION, ue );

                    continueOrThrowSystemOrRemarshal(messageMediator, exception);
                    throw wrapper.statementNotReachable3() ;
                }
            }

            // It was not a comm failure nor unknown.
            // This is the general case.

            // Invoke Portable Interceptors with receive_exception:
            exception = orb.getPIHandler().invokeClientPIEndingPoint(
                ReplyMessage.SYSTEM_EXCEPTION, se );

            continueOrThrowSystemOrRemarshal(messageMediator, exception);

            // Note: We should never need to execute this line, but
            // we should assert in case exception is null somehow.
            throw wrapper.statementNotReachable4() ;
        } else if (messageMediator.isUserExceptionReply()) {

            if (orb.subcontractDebugFlag) {
                dprint(".processResponse: " + opAndId(messageMediator)
                       + ": received user exception");
            }

            getContactInfoListIterator(orb)
                .reportSuccess(messageMediator.getContactInfo());

            String exceptionRepoId = peekUserExceptionId(inputObject);
            Exception newException = null;

            if (messageMediator.isDIIRequest()) {
                exception = messageMediator.unmarshalDIIUserException(
                                exceptionRepoId, (InputStream)inputObject);
                newException = orb.getPIHandler().invokeClientPIEndingPoint(
                                   ReplyMessage.USER_EXCEPTION, exception );
                messageMediator.setDIIException(newException);

            } else {
                ApplicationException appException =
                    new ApplicationException(
                        exceptionRepoId,
                        (org.omg.CORBA.portable.InputStream)inputObject);
                exception = appException;
                newException = orb.getPIHandler().invokeClientPIEndingPoint(
                                   ReplyMessage.USER_EXCEPTION, appException );
            }

            if (newException != exception) {
                continueOrThrowSystemOrRemarshal(messageMediator,newException);
            }

            if (newException instanceof ApplicationException) {
                throw (ApplicationException)newException;
            }
            // For DII:
            // This return will be ignored - already unmarshaled above.
            return inputObject;

        } else if (messageMediator.isLocationForwardReply()) {

            if (orb.subcontractDebugFlag) {
                dprint(".processResponse: " + opAndId(messageMediator)
                       + ": received location forward");
            }

            // NOTE: Expects iterator to update target IOR
            getContactInfoListIterator(orb).reportRedirect(
                (CorbaContactInfo)messageMediator.getContactInfo(),
                messageMediator.getForwardedIOR());

            // Invoke Portable Interceptors with receive_other:
            Exception newException = orb.getPIHandler().invokeClientPIEndingPoint(
                ReplyMessage.LOCATION_FORWARD, null );

            if( !(newException instanceof RemarshalException) ) {
                exception = newException;
            }

            // If PI did not change exception, throw Remarshal, else
            // throw the exception PI wants thrown.
            // KMC: GenericPOAClientSC did not check exception != null
            if( exception != null ) {
                continueOrThrowSystemOrRemarshal(messageMediator, exception);
            }
            continueOrThrowSystemOrRemarshal(messageMediator,
                                             new RemarshalException());
            throw wrapper.statementNotReachable5() ;

        } else if (messageMediator.isDifferentAddrDispositionRequestedReply()){

            if (orb.subcontractDebugFlag) {
                dprint(".processResponse: " + opAndId(messageMediator)
                       + ": received different addressing dispostion request");
            }

            // Set the desired target addressing disposition.
            getContactInfoListIterator(orb).reportAddrDispositionRetry(
                (CorbaContactInfo)messageMediator.getContactInfo(),
                messageMediator.getAddrDispositionReply());

            // Invoke Portable Interceptors with receive_other:
            Exception newException = orb.getPIHandler().invokeClientPIEndingPoint(
                ReplyMessage.NEEDS_ADDRESSING_MODE, null);

            // For consistency with corresponding code in GenericPOAClientSC:
            if( !(newException instanceof RemarshalException) ) {
                exception = newException;
            }

            // If PI did not change exception, throw Remarshal, else
            // throw the exception PI wants thrown.
            // KMC: GenericPOAClientSC did not include exception != null check
            if( exception != null ) {
                continueOrThrowSystemOrRemarshal(messageMediator, exception);
            }
            continueOrThrowSystemOrRemarshal(messageMediator,
                                             new RemarshalException());
            throw wrapper.statementNotReachable6() ;
        } else /* normal response */ {

            if (orb.subcontractDebugFlag) {
                dprint(".processResponse: " + opAndId(messageMediator)
View Full Code Here

            } else {
                info.setRetryRequest( RetryType.BEFORE_RESPONSE ) ;
            }

            // ... and return a RemarshalException so the orb internals know
            exception = new RemarshalException();
        } else if( (piReplyStatus == SYSTEM_EXCEPTION.value) ||
                 (piReplyStatus == USER_EXCEPTION.value) ) {
            exception = info.getException();
        }
View Full Code Here

TOP

Related Classes of org.omg.CORBA.portable.RemarshalException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.