Examples of CorbaMessageMediator


Examples of com.sun.corba.se.spi.protocol.CorbaMessageMediator

            if (ids[i].equals(clientId)) {
                answer = true;
                break;
            }

        CorbaMessageMediator response =
            request.getProtocolHandler().createResponse(request, null);
        ((OutputStream)response.getOutputObject()).write_boolean(answer);
        return response;
    }
View Full Code Here

Examples of com.sun.corba.se.spi.protocol.CorbaMessageMediator

        }
    }

    public void dispatch(MessageMediator messageMediator)
    {
        CorbaMessageMediator request = (CorbaMessageMediator) messageMediator;
        try {
            if (orb.subcontractDebugFlag) {
                dprint(".dispatch->: " + opAndId(request));
            }

            // to set the codebase information, if any transmitted; and also
            // appropriate ORB Version.
            consumeServiceContexts(request);

            // Now that we have the service contexts processed and the
            // correct ORBVersion set, we must finish initializing the
            // stream.
            ((MarshalInputStream)request.getInputObject())
                .performORBVersionSpecificInit();

            ObjectKey okey = request.getObjectKey();

            // Check that this server is the right server
            try {
                checkServerId(okey);
            } catch (ForwardException fex) {
                if (orb.subcontractDebugFlag) {
                    dprint(".dispatch: " + opAndId(request)
                           + ": bad server id");
                }

                request.getProtocolHandler()
                    .createLocationForward(request, fex.getIOR(), null);
                return;
            }

            String operation = request.getOperationName();
            ObjectAdapter objectAdapter = null ;

            try {
                byte[] objectId = okey.getId().getId() ;
                ObjectKeyTemplate oktemp = okey.getTemplate() ;
                objectAdapter = findObjectAdapter(oktemp);

                java.lang.Object servant = getServantWithPI(request, objectAdapter,
                    objectId, oktemp, operation);

                dispatchToServant(servant, request, objectId, objectAdapter);
            } catch (ForwardException ex) {
                if (orb.subcontractDebugFlag) {
                    dprint(".dispatch: " + opAndId(request)
                           + ": ForwardException caught");
                }

                // Thrown by Portable Interceptors from InterceptorInvoker,
                // through Response constructor.
                request.getProtocolHandler()
                    .createLocationForward(request, ex.getIOR(), null);
            } catch (OADestroyed ex) {
                if (orb.subcontractDebugFlag) {
                    dprint(".dispatch: " + opAndId(request)
                           + ": OADestroyed exception caught");
                }

                // DO NOT CALL THIS HERE:
                // releaseServant(objectAdapter);
                // The problem is that OADestroyed is only thrown by oa.enter, in
                // which case oa.exit should NOT be called, and neither should
                // the invocationInfo stack be popped.

                // Destroyed POAs can be recreated by normal adapter activation.
                // So just restart the dispatch.
                dispatch(request);
            } catch (RequestCanceledException ex) {
                if (orb.subcontractDebugFlag) {
                    dprint(".dispatch: " + opAndId(request)
                           + ": RequestCanceledException caught");
                }

                // IDLJ generated non-tie based skeletons do not catch the
                // RequestCanceledException. Rethrow the exception, which will
                // cause the worker thread to unwind the dispatch and wait for
                // other requests.
                throw ex;
            } catch (UnknownException ex) {
                if (orb.subcontractDebugFlag) {
                    dprint(".dispatch: " + opAndId(request)
                           + ": UnknownException caught " + ex);
                }

                // RMIC generated tie skeletons convert all Throwable exception
                // types (including RequestCanceledException, ThreadDeath)
                // thrown during reading fragments into UnknownException.
                // If RequestCanceledException was indeed raised,
                // then rethrow it, which will eventually cause the worker
                // thread to unstack the dispatch and wait for other requests.
                if (ex.originalEx instanceof RequestCanceledException) {
                    throw (RequestCanceledException) ex.originalEx;
                }

                ServiceContexts contexts = new ServiceContexts(orb);
                UEInfoServiceContext usc = new UEInfoServiceContext(
                    ex.originalEx);

                contexts.put( usc ) ;

                SystemException sysex = wrapper.unknownExceptionInDispatch(
                        CompletionStatus.COMPLETED_MAYBE, ex ) ;
                request.getProtocolHandler()
                    .createSystemExceptionResponse(request, sysex,
                        contexts);
            } catch (Throwable ex) {
                if (orb.subcontractDebugFlag) {
                    dprint(".dispatch: " + opAndId(request)
                           + ": other exception " + ex);
                }
                request.getProtocolHandler()
                    .handleThrowableDuringServerDispatch(
                        request, ex, CompletionStatus.COMPLETED_MAYBE);
            }
            return;
        } finally {
View Full Code Here

Examples of com.sun.corba.se.spi.protocol.CorbaMessageMediator

        try {
            if (orb.subcontractDebugFlag) {
                dprint(".dispatchToServant->: " + opAndId(req));
            }

            CorbaMessageMediator response = null ;

            String operation = req.getOperationName() ;

            SpecialMethod method = SpecialMethod.getSpecialMethod(operation) ;
            if (method != null) {
View Full Code Here

Examples of com.sun.corba.se.spi.protocol.CorbaMessageMediator

        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");
View Full Code Here

Examples of com.sun.corba.se.spi.protocol.CorbaMessageMediator

            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 {
View Full Code Here

Examples of com.sun.corba.se.spi.protocol.CorbaMessageMediator

                                       CorbaMessageMediator request,
                                       byte[] objectId,
                                       ObjectAdapter objectAdapter)
    {
        boolean result = (servant == null) || (servant instanceof NullServant) ;
        CorbaMessageMediator response =
            request.getProtocolHandler().createResponse(request, null);
        ((OutputStream)response.getOutputObject()).write_boolean(result);
        return response;
    }
View Full Code Here

Examples of com.sun.corba.se.spi.protocol.CorbaMessageMediator

        throws
            ApplicationException,
            org.omg.CORBA.portable.RemarshalException
    {
      ORB orb = null;
      CorbaMessageMediator messageMediator = null;
      try {
        messageMediator = (CorbaMessageMediator)
            outputObject.getMessageMediator();

        orb = (ORB) messageMediator.getBroker();

        if (orb.subcontractDebugFlag) {
            dprint(".marshalingComplete->: " + opAndId(messageMediator));
        }

        CDROutputObject cdrOutputObject = (CDROutputObject) outputObject;

        //
        // Create server-side input object.
        //

        ByteBufferWithInfo bbwi = cdrOutputObject.getByteBufferWithInfo();
        cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());
        final ORB inOrb = orb;
        final ByteBuffer inBuffer = bbwi.byteBuffer;
        final Message inMsg = cdrOutputObject.getMessageHeader();
        CDRInputObject cdrInputObject = AccessController
                .doPrivileged(new PrivilegedAction<CDRInputObject>() {
                    @Override
                    public CDRInputObject run() {
                        return new CDRInputObject(inOrb, null, inBuffer,
                                inMsg);
                    }
                });
        messageMediator.setInputObject(cdrInputObject);
        cdrInputObject.setMessageMediator(messageMediator);

        //
        // Dispatch
        //

        // REVISIT: Impl cast.
        ((CorbaMessageMediatorImpl)messageMediator).handleRequestRequest(
            messageMediator);

        // InputStream must be closed on the InputObject so that its
        // ByteBuffer can be released to the ByteBufferPool. We must do
        // this before we re-assign the cdrInputObject reference below.
        try { cdrInputObject.close(); }
        catch (IOException ex) {
            // No need to do anything since we're done with the input stream
            // and cdrInputObject will be re-assigned a new client-side input
            // object, (i.e. won't result in a corba error).

            if (orb.transportDebugFlag) {
               dprint(".marshalingComplete: ignoring IOException - " + ex.toString());
            }
        }

        //
        // Create client-side input object
        //

        cdrOutputObject = (CDROutputObject) messageMediator.getOutputObject();
        bbwi = cdrOutputObject.getByteBufferWithInfo();
        cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());
        final ORB inOrb2 = orb;
        final ByteBuffer inBuffer2 = bbwi.byteBuffer;
        final Message inMsg2 = cdrOutputObject.getMessageHeader();
        cdrInputObject = AccessController
                .doPrivileged(new PrivilegedAction<CDRInputObject>() {
                    @Override
                    public CDRInputObject run() {
                        return new CDRInputObject(inOrb2, null, inBuffer2,
                                inMsg2);
                    }
                });
        messageMediator.setInputObject(cdrInputObject);
        cdrInputObject.setMessageMediator(messageMediator);

        cdrInputObject.unmarshalHeader();

        InputObject inputObject = cdrInputObject;
View Full Code Here

Examples of com.sun.corba.se.spi.protocol.CorbaMessageMediator

    {
        try {
            if (orb.transportDebugFlag) {
                dprint(".read->: " + this);
            }
            CorbaMessageMediator messageMediator = readBits();
            if (messageMediator != null) {
                // Null can happen when client closes stream
                // causing purgecalls.
                return dispatch(messageMediator);
            }
View Full Code Here

Examples of com.sun.corba.se.spi.protocol.CorbaMessageMediator

                read();
            }
            else {
                // get the partialMessageMediator
                // created by SelectorThread
                CorbaMessageMediator messageMediator =
                                         this.getPartialMessageMediator();

                // read remaining info needed in a MessageMediator
                messageMediator = finishReadingBits(messageMediator);
View Full Code Here

Examples of com.sun.corba.se.spi.protocol.CorbaMessageMediator

                    }
                }
            }
        }

        CorbaMessageMediator messageMediator = (CorbaMessageMediator)
            contactInfo.createMessageMediator(
                orb, contactInfo, connection, opName, isOneWay);
        if (orb.subcontractDebugFlag) {
            dprint(".beginRequest: " + opAndId(messageMediator)
                   + ": created message mediator: " +  messageMediator);
        }

        // NOTE: Thread data so we can get the mediator in release reply
        // in order to remove the waiter in CorbaConnection.
        // We cannot depend on obtaining information in releaseReply
        // via its InputStream argument since, on certain errors
        // (e.g., client marshaling errors), the stream may be null.
        // Likewise for releaseReply "self".
        // NOTE: This must be done before initializing the message since
        // that may start sending fragments which may end up in "early"
        // replies or client marshaling exceptions.

        orb.getInvocationInfo().setMessageMediator(messageMediator);

        if (connection != null && connection.getCodeSetContext() == null) {
            performCodeSetNegotiation(messageMediator);
        }

        addServiceContexts(messageMediator);

        OutputObject outputObject =
            contactInfo.createOutputObject(messageMediator);
        if (orb.subcontractDebugFlag) {
            dprint(".beginRequest: " + opAndId(messageMediator)
                   + ": created output object: " + outputObject);
        }


        // NOTE: Not necessary for oneways, but useful for debugging.
        // This must be done BEFORE message initialization since fragments
        // may be sent at that time.
        registerWaiter(messageMediator);

        // Do connection reclaim now
        synchronized (lock) {
            if (contactInfo.isConnectionBased()) {
                if (contactInfo.shouldCacheConnection()) {
                    OutboundConnectionCache connectionCache =
                             orb.getTransportManager()
                                .getOutboundConnectionCache(contactInfo);
                    connectionCache.reclaim();
                }
            }
        }

        orb.getPIHandler().setClientPIInfo(messageMediator);
        try {
            // This MUST come before message is initialized so
            // service contexts may be added by PI because
            // initial fragments may be sent during message initialization.
            orb.getPIHandler().invokeClientPIStartingPoint();
        } catch( RemarshalException e ) {
            if (orb.subcontractDebugFlag) {
                dprint(".beginRequest: " + opAndId(messageMediator)
                       + ": Remarshal");
            }

            // NOTE: We get here because an interceptor raised ForwardRequest
            // and updated the IOR/Iterator.  Since we have a fresh iterator
            // hasNext should succeed.

            // REVISIT: We should feed ALL interceptor exceptions to
            // iterator.reportException so it can determine if it wants
            // to retry.  Right now, SystemExceptions will flow to the
            // client code.

            // REVISIT:
            // This assumes that interceptors update
            // ContactInfoList outside of subcontract.
            // Want to move that update to here.
            if (getContactInfoListIterator(orb).hasNext()) {
                contactInfo = (ContactInfo)getContactInfoListIterator(orb).next();
                if (orb.subcontractDebugFlag) {
                    dprint( "RemarshalException: hasNext true\ncontact info " + contactInfo );
                }

                // Fix for 6763340: Complete the first attempt before starting another.
                orb.getPIHandler().makeCompletedClientRequest(
                    ReplyMessage.LOCATION_FORWARD, null ) ;
                unregisterWaiter(orb);
                orb.getPIHandler().cleanupClientPIRequest() ;

                return beginRequest(self, opName, isOneWay, contactInfo);
            } else {
                if (orb.subcontractDebugFlag) {
                    dprint( "RemarshalException: hasNext false" );
                }
                ORBUtilSystemException wrapper =
                    ORBUtilSystemException.get(orb,
                                               CORBALogDomains.RPC_PROTOCOL);
                throw wrapper.remarshalWithNowhereToGo();
            }
        }

        messageMediator.initializeMessage();
        if (orb.subcontractDebugFlag) {
            dprint(".beginRequest: " + opAndId(messageMediator)
                   + ": initialized message");
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.