Package com.sun.corba.se.spi.orb

Examples of com.sun.corba.se.spi.orb.ORB


                                       CorbaMessageMediator request,
                                       byte[] objectId,
                                       ObjectAdapter objectAdapter)
    {
        if ((servant == null) || (servant instanceof NullServant)) {
            ORB orb = (ORB)request.getBroker() ;
            ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
                CORBALogDomains.OA_INVOCATION ) ;

            return request.getProtocolHandler().createSystemExceptionResponse(
                request, wrapper.badSkeleton(), null);
View Full Code Here


    public CorbaMessageMediator invoke(java.lang.Object servant,
                                       CorbaMessageMediator request,
                                       byte[] objectId,
                                       ObjectAdapter objectAdapter)
    {
        ORB orb = (ORB)request.getBroker() ;
        ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
            CORBALogDomains.OA_INVOCATION ) ;

        if ((servant == null) || (servant instanceof NullServant)) {
            return request.getProtocolHandler().createSystemExceptionResponse(
View Full Code Here

        // the legacy support is removed, this code will need
        // to create an Acceptor directly.
        props.put( ORBConstants.SERVER_PORT_PROPERTY,
            Integer.toString( initialPort ) ) ;

        ORB orb = (ORB) org.omg.CORBA.ORB.init(args,props);

        LocalResolver lres = orb.getLocalResolver() ;
        Resolver fres = ResolverDefault.makeFileResolver( orb, file ) ;
        Resolver cres = ResolverDefault.makeCompositeResolver( fres, lres ) ;
        LocalResolver sres = ResolverDefault.makeSplitLocalResolver( cres, lres ) ;

        orb.setLocalResolver( sres ) ;

        try {
            // This causes the acceptors to start listening.
            orb.resolve_initial_references(ORBConstants.ROOT_POA_NAME);
        } catch (org.omg.CORBA.ORBPackage.InvalidName e) {
            RuntimeException rte = new RuntimeException("This should not happen");
            rte.initCause(e);
            throw rte;
        }

        orb.run() ;
    }
View Full Code Here

                                          OutputObject outputObject)
        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
View Full Code Here

     * Static method for writing a CORBA standard exception to an Any.
     * @param any The Any to write the SystemException into.
     */
    public static void insertSystemException(SystemException ex, Any any) {
        OutputStream out = any.create_output_stream();
        ORB orb = (ORB)(out.orb());
        String name = ex.getClass().getName();
        String repID = ORBUtility.repositoryIdOf(name);
        out.write_string(repID);
        out.write_long(ex.minor);
        out.write_long(ex.completed.value());
View Full Code Here

            getSystemExceptionTypeCode(orb, repID, name));
    }

    public static SystemException extractSystemException(Any any) {
        InputStream in = any.create_input_stream();
        ORB orb = (ORB)(in.orb());
        if ( ! isSystemExceptionTypeCode(any.type(), orb)) {
            throw wrapper.unknownDsiSysex(CompletionStatus.COMPLETED_MAYBE);
        }
        return ORBUtility.readSystemException(in);
    }
View Full Code Here

            return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion();
    }

    public static CorbaClientDelegate makeClientDelegate( IOR ior )
    {
        ORB orb = ior.getORB() ;
        CorbaContactInfoList ccil = orb.getCorbaContactInfoListFactory().create( ior ) ;
        CorbaClientDelegate del = orb.getClientDelegateFactory().create(ccil);
        return del ;
    }
View Full Code Here

            new ConcurrentHashMap<ContactInfo, Object>();

    public OutputObject beginRequest(Object self, String opName,
                                     boolean isOneWay, ContactInfo contactInfo)
    {
      ORB orb = null;
      try {
        CorbaContactInfo corbaContactInfo = (CorbaContactInfo) contactInfo;
        orb =  (ORB)contactInfo.getBroker();

        if (orb.subcontractDebugFlag) {
            dprint(".beginRequest->: op/" + opName);
        }

        //
        // Portable Interceptor initialization.
        //

        orb.getPIHandler().initiateClientPIRequest( false );

        //
        // Connection.
        //

        CorbaConnection connection = null;

        // This locking is done so that multiple connections are not created
        // for the same endpoint
        // 7046238 - Synchronization on a single monitor for contactInfo parameters
        // with identical hashCode(), so we lock on same monitor for equal parameters
        // (which can refer to equal (in terms of equals()) but not the same objects)

        Object lock = locks.get(contactInfo);

        if (lock == null) {
            Object newLock = new Object();
            lock = locks.putIfAbsent(contactInfo, newLock);
            if (lock == null) {
                lock = newLock;
            }
        }

        synchronized (lock) {
            if (contactInfo.isConnectionBased()) {
                if (contactInfo.shouldCacheConnection()) {
                    connection = (CorbaConnection)
                        orb.getTransportManager()
                        .getOutboundConnectionCache(contactInfo).get(contactInfo);
                }
                if (connection != null) {
                    if (orb.subcontractDebugFlag) {
                        dprint(".beginRequest: op/" + opName
                               + ": Using cached connection: " + connection);
                    }
                } else {
                    try {
                        connection = (CorbaConnection)
                            contactInfo.createConnection();
                        if (orb.subcontractDebugFlag) {
                            dprint(".beginRequest: op/" + opName
                                   + ": Using created connection: " + connection);
                        }
                    } catch (RuntimeException e) {
                        if (orb.subcontractDebugFlag) {
                            dprint(".beginRequest: op/" + opName
                                   + ": failed to create connection: " + e);
                        }
                        // REVISIT: this part similar to marshalingComplete below.
                        boolean retry = getContactInfoListIterator(orb)
                                           .reportException(contactInfo, e);
                        // REVISIT:
                        // this part similar to Remarshal in this method below
                        if (retry) {
                            if(getContactInfoListIterator(orb).hasNext()) {
                                contactInfo = (ContactInfo)
                                   getContactInfoListIterator(orb).next();
                                unregisterWaiter(orb);
                                return beginRequest(self, opName,
                                                    isOneWay, contactInfo);
                            } else {
                                throw e;
                            }
                        } else {
                            throw e;
                        }
                    }
                    if (connection.shouldRegisterReadEvent()) {
                        // REVISIT: cast
                        orb.getTransportManager().getSelector(0)
                            .registerForEvent(connection.getEventHandler());
                        connection.setState("ESTABLISHED");
                    }
                    // Do not do connection reclaim here since the connections
                    // are marked in use by registerWaiter() call and since this
                    // call happens later do it after that.
                    if (contactInfo.shouldCacheConnection()) {
                        OutboundConnectionCache connectionCache =
                         orb.getTransportManager()
                            .getOutboundConnectionCache(contactInfo);
                        connectionCache.stampTime(connection);
                        connectionCache.put(contactInfo, connection);
    //              connectionCache.reclaim();
                    }
                }
            }
        }

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

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

        CorbaMessageMediator messageMediator, Exception exception)
        throws
            SystemException, RemarshalException
    {

        ORB orb = (ORB) messageMediator.getBroker();

        if( exception == null ) {

            // do nothing.

        } else if( exception instanceof RemarshalException ) {

            // REVISIT - unify with PI handling
            orb.getInvocationInfo().setIsRetryInvocation(true);

            // NOTE - We must unregister the waiter NOW for this request
            // since the retry will result in a new request id.  Therefore
            // the old request id would be lost and we would have a memory
            // leak in the responseWaitingRoom.
View Full Code Here

TOP

Related Classes of com.sun.corba.se.spi.orb.ORB

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.