public void get_response()

in yoko-core/src/main/java/org/apache/yoko/orb/CORBA/Request.java [449:560]


    public void get_response() {
        org.apache.yoko.orb.OB.ORBInstance orbInstance = delegate_
                ._OB_ORBInstance();
        org.apache.yoko.orb.OB.MultiRequestSender multi = orbInstance
                .getMultiRequestSender();

        synchronized (stateMutex_) {
            if (!pollable_)
                throw new org.omg.CORBA.BAD_INV_ORDER(
                        org.apache.yoko.orb.OB.MinorCodes
                                .describeBadInvOrder(org.apache.yoko.orb.OB.MinorCodes.MinorSynchronousRequest),
                        org.apache.yoko.orb.OB.MinorCodes.MinorSynchronousRequest,
                        org.omg.CORBA.CompletionStatus.COMPLETED_NO);

            switch (state_) {
            case RequestStateUnsent:
            case RequestStatePending:
                throw new org.omg.CORBA.BAD_INV_ORDER(
                        org.apache.yoko.orb.OB.MinorCodes
                                .describeBadInvOrder(org.apache.yoko.orb.OB.MinorCodes.MinorRequestNotSent),
                        org.apache.yoko.orb.OB.MinorCodes.MinorRequestNotSent,
                        org.omg.CORBA.CompletionStatus.COMPLETED_NO);
            case RequestStateSent:
                break;
            case RequestStateReceiving:
            case RequestStateDone:
                throw new org.omg.CORBA.BAD_INV_ORDER(
                        org.apache.yoko.orb.OB.MinorCodes
                                .describeBadInvOrder(org.apache.yoko.orb.OB.MinorCodes.MinorResponseAlreadyReceived),
                        org.apache.yoko.orb.OB.MinorCodes.MinorResponseAlreadyReceived,
                        org.omg.CORBA.CompletionStatus.COMPLETED_NO);
            case RequestStateReceived:
                multi.removeDeferredRequest(this);
                state_ = RequestStateDone;
                return;
            }

            //
            // Allow thread calling poll_response to complete
            //
            while (polling_) {
                try {
                    stateMutex_.wait();
                } catch (InterruptedException ex) {
                }
            }

            if (state_ == RequestStateReceived) {
                multi.removeDeferredRequest(this);
                state_ = RequestStateDone;
                return;
            } else {
                org.apache.yoko.orb.OB.Assert
                        ._OB_assert(state_ == RequestStateSent);
                multi.removeDeferredRequest(this);
                state_ = RequestStateReceiving;
            }
        }

        org.apache.yoko.orb.OB.Assert._OB_assert(downcallStub_ != null);
        org.apache.yoko.orb.OB.Assert._OB_assert(downcall_ != null);

        boolean send = false;
        try {
            RetryInfo info = new RetryInfo();
            while (true) {
                try {
                    if (send)
                        downcallStub_ = delegate_._OB_getDowncallStub(target_);

                    while (true) {
                        if (send) {
                            downcall_ = downcallStub_.createPIDIIDowncall(
                                    operation_, true, arguments_, result_,
                                    exceptions_);
                        }

                        try {
                            if (send) {
                                marshal();
                                downcallStub_.deferred(downcall_);
                                send = false;
                            }

                            downcallStub_.response(downcall_);
                            unmarshal();
                            synchronized (stateMutex_) {
                                state_ = RequestStateDone;
                            }
                            return;
                        } catch (org.apache.yoko.orb.OB.FailureException ex) {
                            downcallStub_.handleFailureException(downcall_, ex);
                            send = true;
                        }
                    } // while(true)
                } catch (Exception ex) {
                    delegate_._OB_handleException(target_, ex, info, false);
                    send = true;
                }
            } // while(true)
        } catch (org.omg.CORBA.SystemException ex) {
            Logger logger = delegate_._OB_ORBInstance().getLogger(); 
            logger.log(java.util.logging.Level.FINE, "Exception getting request response", ex); 
            environment_.exception(ex);
            synchronized (stateMutex_) {
                state_ = RequestStateDone;
            }
            if (raiseDIIExceptions_)
                throw ex;
            return;
        }
    }