Java Code Examples for com.sun.corba.se.impl.orbutil.ORBUtility

The following are top voted examples for showing how to use com.sun.corba.se.impl.orbutil.ORBUtility. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: openjdk-jdk10   File: InterceptorInvoker.java   View source code 6 votes vote down vote up
/**
 * Update the client delegate in the event of a ForwardRequest, given the
 * information in the passed-in info object.
 */
private void updateClientRequestDispatcherForward(
    ClientRequestInfoImpl info )
{
    ForwardRequest forwardRequest = info.getForwardRequestException();

    // ForwardRequest may be null if the forwarded IOR is set internal
    // to the ClientRequestDispatcher rather than explicitly through Portable
    // Interceptors.  In this case, we need not update the client
    // delegate ForwardRequest object.
    if( forwardRequest != null ) {
        org.omg.CORBA.Object object = forwardRequest.forward;

        // Convert the forward object into an IOR:
        IOR ior = ORBUtility.getIOR( object ) ;
        info.setLocatedIOR( ior );
    }
}
 
Example 2
Project: OpenJSharp   File: INSURLOperationImpl.java   View source code 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example 3
Project: openjdk-jdk10   File: POAImpl.java   View source code 6 votes vote down vote up
/**
 * <code>deactivate_object</code>
 * <b>3.3.8.16</b>
 */
public void deactivate_object(byte[] id)
    throws ObjectNotActive, WrongPolicy
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Calling deactivate_object on poa " + this +
                " (id=" + id + ")" ) ;
        }

        mediator.deactivateObject( id ) ;
    } finally {
        if (debug) {
            ORBUtility.dprint( this,
                "Exiting deactivate_object on poa " + this ) ;
        }

        unlock() ;
    }
}
 
Example 4
Project: openjdk-jdk10   File: POAImpl.java   View source code 6 votes vote down vote up
/**
 * <code>create_reference</code>
 * <b>3.3.8.17</b>
 */
public org.omg.CORBA.Object create_reference(String repId)
    throws WrongPolicy
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this, "Calling create_reference(repId=" +
                repId + ") on poa " + this ) ;
        }

        return makeObject( repId, mediator.newSystemId()) ;
    } finally {
        unlock() ;
    }
}
 
Example 5
Project: OpenJSharp   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
public void write_Object(org.omg.CORBA.Object ref)
{
    if (ref == null) {
        IOR nullIOR = IORFactories.makeIOR( orb ) ;
        nullIOR.write(parent);
        return;
    }

    // IDL to Java formal 01-06-06 1.21.4.2
    if (ref instanceof org.omg.CORBA.LocalObject)
        throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE);

    IOR ior = ORBUtility.connectAndGetIOR( orb, ref ) ;
    ior.write(parent);
    return;
}
 
Example 6
Project: openjdk-jdk10   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
public void write_wchar(char x)
{
    // Don't allow transmission of wchar/wstring data with
    // foreign ORBs since it's against the spec.
    if (ORBUtility.isForeignORB(orb)) {
        throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE);
    }

    // If it's one of our legacy ORBs, do what they did:
    alignAndReserve(2, 2);

    if (littleEndian) {
        writeLittleEndianWchar(x);
    } else {
        writeBigEndianWchar(x);
    }
}
 
Example 7
Project: openjdk-jdk10   File: BootstrapResolverImpl.java   View source code 6 votes vote down vote up
public BootstrapResolverImpl(ORB orb, String host, int port) {
    wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.ORB_RESOLVER ) ;

    // Create a new IOR with the magic of INIT
    byte[] initialKey = "INIT".getBytes() ;
    ObjectKey okey = orb.getObjectKeyFactory().create(initialKey) ;

    IIOPAddress addr = IIOPFactories.makeIIOPAddress( orb, host, port ) ;
    IIOPProfileTemplate ptemp = IIOPFactories.makeIIOPProfileTemplate(
        orb, GIOPVersion.V1_0, addr);

    IORTemplate iortemp = IORFactories.makeIORTemplate( okey.getTemplate() ) ;
    iortemp.add( ptemp ) ;

    IOR initialIOR = iortemp.makeIOR( (com.sun.corba.se.spi.orb.ORB)orb,
        "", okey.getId() ) ;

    bootstrapDelegate = ORBUtility.makeClientDelegate( initialIOR ) ;
}
 
Example 8
Project: OpenJSharp   File: StateEngineImpl.java   View source code 6 votes vote down vote up
public void doIt( FSM fsm, Input in, boolean debug )
{
    // This method is present only for debugging.
    // innerDoIt does the actual transition.

    if (debug)
        ORBUtility.dprint( this, "doIt enter: currentState = " +
            fsm.getState() + " in = " + in ) ;

    try {
        innerDoIt( fsm, in, debug ) ;
    } finally {
        if (debug)
            ORBUtility.dprint( this, "doIt exit" ) ;
    }
}
 
Example 9
Project: OpenJSharp   File: POAImpl.java   View source code 6 votes vote down vote up
void etherealizeAll()
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Calling etheralizeAll on poa " + this ) ;
        }

        mediator.etherealizeAll() ;
    } finally {
        if (debug) {
            ORBUtility.dprint( this,
                "Exiting etheralizeAll on poa " + this ) ;
        }

        unlock() ;
    }
}
 
Example 10
Project: OpenJSharp   File: POAImpl.java   View source code 6 votes vote down vote up
/**
 * <code>the_activator</code>
 * <b>Section 3.3.8.9</b>
 */
public void the_activator(AdapterActivator activator)
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this, "Calling the_activator on poa " +
                this + " activator=" + activator ) ;
        }

        this.activator = activator;
    } finally {
        unlock() ;
    }
}
 
Example 11
Project: openjdk-jdk10   File: ReentrantMutex.java   View source code 6 votes vote down vote up
synchronized int releaseAll()
{
    try {
        if (debug)
            ORBUtility.dprintTrace( this, "releaseAll enter: " +
                " holder_=" + ORBUtility.getThreadName(holder_) +
                " counter_=" + counter_ ) ;

        Thread thr = Thread.currentThread();
        if (thr != holder_)
            throw new INTERNAL(
                "Attempt to releaseAll Mutex by thread not holding the Mutex" ) ;

        int result = counter_ ;
        counter_ = 0 ;
        holder_ = null ;
        notify() ;
        return result ;
    } finally {
        if (debug)
            ORBUtility.dprintTrace( this, "releaseAll exit: " +
                " holder_=" + ORBUtility.getThreadName(holder_) +
                " counter_=" + counter_ ) ;
    }
}
 
Example 12
Project: openjdk-jdk10   File: StateEngineImpl.java   View source code 6 votes vote down vote up
public void doIt( FSM fsm, Input in, boolean debug )
{
    // This method is present only for debugging.
    // innerDoIt does the actual transition.

    if (debug)
        ORBUtility.dprint( this, "doIt enter: currentState = " +
            fsm.getState() + " in = " + in ) ;

    try {
        innerDoIt( fsm, in, debug ) ;
    } finally {
        if (debug)
            ORBUtility.dprint( this, "doIt exit" ) ;
    }
}
 
Example 13
Project: OpenJSharp   File: InterceptorInvoker.java   View source code 6 votes vote down vote up
/**
 * Update the client delegate in the event of a ForwardRequest, given the
 * information in the passed-in info object.
 */
private void updateClientRequestDispatcherForward(
    ClientRequestInfoImpl info )
{
    ForwardRequest forwardRequest = info.getForwardRequestException();

    // ForwardRequest may be null if the forwarded IOR is set internal
    // to the ClientRequestDispatcher rather than explicitly through Portable
    // Interceptors.  In this case, we need not update the client
    // delegate ForwardRequest object.
    if( forwardRequest != null ) {
        org.omg.CORBA.Object object = forwardRequest.forward;

        // Convert the forward object into an IOR:
        IOR ior = ORBUtility.getIOR( object ) ;
        info.setLocatedIOR( ior );
    }
}
 
Example 14
Project: OpenJSharp   File: POAImpl.java   View source code 6 votes vote down vote up
/**
 * <code>servant_to_reference</code>
 * <b>3.3.8.20</b>
 */
public org.omg.CORBA.Object servant_to_reference(Servant servant)
    throws ServantNotActive, WrongPolicy
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Calling servant_to_reference(servant=" +
                servant + ") on poa " + this ) ;
        }

        byte[] oid = mediator.servantToId(servant);
        String repId = servant._all_interfaces( this, oid )[0] ;
        return create_reference_with_id(oid, repId);
    } finally {
        unlock() ;
    }
}
 
Example 15
Project: OpenJSharp   File: POAImpl.java   View source code 6 votes vote down vote up
/**
 * <code>reference_to_servant</code>
 * <b>3.3.8.21</b>
 */
public Servant reference_to_servant(org.omg.CORBA.Object reference)
    throws ObjectNotActive, WrongPolicy, WrongAdapter
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Calling reference_to_servant(reference=" +
                reference + ") on poa " + this ) ;
        }

        if ( state >= STATE_DESTROYING ) {
            throw lifecycleWrapper().adapterDestroyed() ;
        }

        // reference_to_id should throw WrongAdapter
        // if the objref was not created by this POA
        byte [] id = internalReferenceToId(reference);

        return mediator.idToServant( id ) ;
    } finally {
        unlock() ;
    }
}
 
Example 16
Project: OpenJSharp   File: POAImpl.java   View source code 6 votes vote down vote up
/**
 * <code>id_to_reference</code>
 * <b>3.3.8.24</b>
 */
public org.omg.CORBA.Object id_to_reference(byte[] id)
    throws ObjectNotActive, WrongPolicy

{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this, "Calling id_to_reference(id=" +
                id + ") on poa " + this ) ;
        }

        if( state >= STATE_DESTROYING ) {
            throw lifecycleWrapper().adapterDestroyed() ;
        }

        Servant s = mediator.idToServant( id ) ;
        String repId = s._all_interfaces( this, id )[0] ;
        return makeObject(repId, id );
    } finally {
        unlock() ;
    }
}
 
Example 17
Project: OpenJSharp   File: POAImpl.java   View source code 6 votes vote down vote up
public void exit()
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this, "Calling exit on poa " + this ) ;
        }

        invocationCount--;

        if ((invocationCount == 0) && (state == STATE_DESTROYING)) {
            invokeCV.broadcast();
        }
    } finally {
        if (debug) {
            ORBUtility.dprint( this, "Exiting exit on poa " + this ) ;
        }

        unlock() ;
    }

    manager.exit();
}
 
Example 18
Project: openjdk-jdk10   File: POAImpl.java   View source code 6 votes vote down vote up
private boolean waitUntilRunning()
{
    if (debug) {
        ORBUtility.dprint( this,
            "Calling waitUntilRunning on poa " + this ) ;
    }

    while (state < STATE_RUN) {
        try {
            adapterActivatorCV.await() ;
        } catch (InterruptedException exc) {
            // NO-OP
        }
    }

    if (debug) {
        ORBUtility.dprint( this,
            "Exiting waitUntilRunning on poa " + this ) ;
    }

    // Note that a POA could be destroyed while in STATE_INIT due to a
    // failure in the AdapterActivator upcall.
    return (state == STATE_RUN) ;
}
 
Example 19
Project: OpenJSharp   File: POAManagerImpl.java   View source code 6 votes vote down vote up
synchronized void exit()
{
    try {
        if (debug) {
            ORBUtility.dprint( this,
                "Calling exit for POAManagerImpl " + this ) ;
        }

        nInvocations--;

        if ( nInvocations == 0 ) {
            // This notifies any threads that were in the
            // wait_for_completion loop in hold/discard/deactivate().
            notifyWaiters();
        }
    } finally {
        if (debug) {
            ORBUtility.dprint( this,
                "Exiting exit for POAManagerImpl " + this ) ;
        }
    }
}
 
Example 20
Project: OpenJSharp   File: TransientObjectManager.java   View source code 6 votes vote down vote up
public synchronized java.lang.Object lookupServant(byte transientKey[])
{
    int index = ORBUtility.bytesToInt(transientKey,0);
    int counter = ORBUtility.bytesToInt(transientKey,4);

    if (orb.transientObjectManagerDebugFlag)
        dprint( "lookupServant called with index=" + index + ", counter=" + counter ) ;

    if (elementArray[index].counter == counter &&
        elementArray[index].valid ) {
        if (orb.transientObjectManagerDebugFlag)
            dprint( "\tcounter is valid" ) ;
        return elementArray[index].servant;
    }

    // servant not found
    if (orb.transientObjectManagerDebugFlag)
        dprint( "\tcounter is invalid" ) ;
    return null;
}
 
Example 21
Project: openjdk-jdk10   File: POAImpl.java   View source code 6 votes vote down vote up
public void doIt( POAImpl thePoa, boolean wait )
{
    if (debug) {
        ORBUtility.dprint( this,
            "Calling DestroyThread.doIt(thePOA=" + thePoa +
            " wait=" + wait + " etherealize=" + etherealize ) ;
    }

    this.thePoa = thePoa ;
    this.wait = wait ;

    if (wait) {
        run() ;
    } else {
        // Catch exceptions since setDaemon can cause a
        // security exception to be thrown under netscape
        // in the Applet mode
        try { setDaemon(true); } catch (Exception e) {}
        start() ;
    }
}
 
Example 22
Project: openjdk-jdk10   File: POAImpl.java   View source code 6 votes vote down vote up
/**
 * <code>the_activator</code>
 * <b>Section 3.3.8.9</b>
 */
public void the_activator(AdapterActivator activator)
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this, "Calling the_activator on poa " +
                this + " activator=" + activator ) ;
        }

        this.activator = activator;
    } finally {
        unlock() ;
    }
}
 
Example 23
Project: openjdk-jdk10   File: POAImpl.java   View source code 6 votes vote down vote up
/**
 * <code>set_servant_manager</code>
 * <b>Section 3.3.8.10</b>
 */
public void set_servant_manager(ServantManager servantManager)
    throws WrongPolicy
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this, "Calling set_servant_manager on poa " +
                this + " servantManager=" + servantManager ) ;
        }

        mediator.setServantManager( servantManager ) ;
    } finally {
        unlock() ;
    }
}
 
Example 24
Project: openjdk-jdk10   File: POAImpl.java   View source code 6 votes vote down vote up
private byte[] internalReferenceToId(
    org.omg.CORBA.Object reference ) throws WrongAdapter
{
    IOR ior = ORBUtility.getIOR( reference ) ;
    IORTemplateList thisTemplate = ior.getIORTemplates() ;

    ObjectReferenceFactory orf = getCurrentFactory() ;
    IORTemplateList poaTemplate =
        IORFactories.getIORTemplateList( orf ) ;

    if (!poaTemplate.isEquivalent( thisTemplate ))
        throw new WrongAdapter();

    // Extract the ObjectId from the first TaggedProfile in the IOR.
    // If ior was created in this POA, the same ID was used for
    // every profile through the profile templates in the currentFactory,
    // so we will get the same result from any profile.
    Iterator iter = ior.iterator() ;
    if (!iter.hasNext())
        throw iorWrapper().noProfilesInIor() ;
    TaggedProfile prof = (TaggedProfile)(iter.next()) ;
    ObjectId oid = prof.getObjectId() ;

    return oid.getId();
}
 
Example 25
Project: openjdk-jdk10   File: POAImpl.java   View source code 5 votes vote down vote up
void lock()
{
    SyncUtil.acquire( poaMutex ) ;

    if (debug) {
        ORBUtility.dprint( this, "LOCKED poa " + this ) ;
    }
}
 
Example 26
Project: openjdk-jdk10   File: CorbaMessageMediatorImpl.java   View source code 5 votes vote down vote up
public CorbaMessageMediatorImpl(ORB orb,
                                ContactInfo contactInfo,
                                Connection connection,
                                GIOPVersion giopVersion,
                                IOR ior,
                                int requestId,
                                short addrDisposition,
                                String operationName,
                                boolean isOneWay)
{
    this( orb, connection ) ;

    this.contactInfo = (CorbaContactInfo) contactInfo;
    this.addrDisposition = addrDisposition;

    streamFormatVersion =
        getStreamFormatVersionForThisRequest(
            ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(),
            giopVersion);
    streamFormatVersionSet = true;

    requestHeader = (RequestMessage) MessageBase.createRequest(
        this.orb,
        giopVersion,
        ORBUtility.getEncodingVersion(orb, ior),
        requestId,
        !isOneWay,
        ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(),
        this.addrDisposition,
        operationName,
        new ServiceContexts(orb),
        null);
}
 
Example 27
Project: openjdk-jdk10   File: CDROutputStream_1_0.java   View source code 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example 28
Project: openjdk-jdk10   File: CDROutputStream_1_0.java   View source code 5 votes vote down vote up
public void write_abstract_interface(java.lang.Object obj) {
    boolean corbaObject = false; // Assume value type.
    org.omg.CORBA.Object theObject = null;

    // Is it a CORBA.Object?

    if (obj != null && obj instanceof org.omg.CORBA.Object) {

        // Yes.

        theObject = (org.omg.CORBA.Object)obj;
        corbaObject = true;
    }

    // Write our flag...

    write_boolean(corbaObject);

    // Now write out the object...

    if (corbaObject) {
        write_Object(theObject);
    } else {
        try {
            write_value((java.io.Serializable)obj);
        } catch(ClassCastException cce) {
            if (obj instanceof java.io.Serializable)
                throw cce;
            else
                ORBUtility.throwNotSerializableForCorba(obj.getClass().getName());
        }
    }
}
 
Example 29
Project: OpenJSharp   File: INSServerRequestDispatcher.java   View source code 5 votes vote down vote up
/**
 * getINSReference if it is registered in INSObjectKeyMap.
 */
private IOR getINSReference( String insKey ) {
    IOR entry = ORBUtility.getIOR( orb.getLocalResolver().resolve( insKey ) ) ;
    if( entry != null ) {
        // If entry is not null then the locate is with an INS Object key,
        // so send a location forward with the right IOR.
        return entry;
    }

    throw wrapper.servantNotFound() ;
}
 
Example 30
Project: openjdk-jdk10   File: CDROutputStream_1_0.java   View source code 5 votes vote down vote up
public void write_wstring(String value)
{
    if (value == null)
        throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);

    // Don't allow transmission of wchar/wstring data with
    // foreign ORBs since it's against the spec.
    if (ORBUtility.isForeignORB(orb)) {
        throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE);
    }

    // When talking to our legacy ORBs, do what they did:
    int len = value.length() + 1;

    // This will only have an effect if we're already chunking
    handleSpecialChunkBegin(4 + (len * 2) + computeAlignment(4));

    write_long(len);

    for (int i = 0; i < len - 1; i++)
        write_wchar(value.charAt(i));

    // Write the null ending
    write_short((short)0);

    // This will only have an effect if we're already chunking
    handleSpecialChunkEnd();
}
 
Example 31
Project: openjdk-jdk10   File: RequestInfoImpl.java   View source code 5 votes vote down vote up
/**
 * Retrieves the IOR of the ForwardRequest exception.
 */
protected IOR getForwardRequestIOR() {
    if( this.forwardRequestIOR == null ) {
        if( this.forwardRequest != null ) {
            this.forwardRequestIOR = ORBUtility.getIOR(
                this.forwardRequest.forward ) ;
        }
    }

    return this.forwardRequestIOR;
}
 
Example 32
Project: OpenJSharp   File: ReplyMessage_1_0.java   View source code 5 votes vote down vote up
public void read(org.omg.CORBA.portable.InputStream istream) {
    super.read(istream);
    this.service_contexts
        = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream);
    this.request_id = istream.read_ulong();
    this.reply_status = istream.read_long();
    isValidReplyStatus(this.reply_status); // raises exception on error

    // The code below reads the reply body in some cases
    // SYSTEM_EXCEPTION & LOCATION_FORWARD
    if (this.reply_status == SYSTEM_EXCEPTION) {

        String reposId = istream.read_string();
        this.exClassName = ORBUtility.classNameOf(reposId);
        this.minorCode = istream.read_long();
        int status = istream.read_long();

        switch (status) {
        case CompletionStatus._COMPLETED_YES:
            this.completionStatus = CompletionStatus.COMPLETED_YES;
            break;
        case CompletionStatus._COMPLETED_NO:
            this.completionStatus = CompletionStatus.COMPLETED_NO;
            break;
        case CompletionStatus._COMPLETED_MAYBE:
            this.completionStatus = CompletionStatus.COMPLETED_MAYBE;
            break;
        default:
            throw wrapper.badCompletionStatusInReply(
                CompletionStatus.COMPLETED_MAYBE, new Integer(status) );
        }

    } else if (this.reply_status == USER_EXCEPTION) {
        // do nothing. The client stub will read the exception from body.
    } else if (this.reply_status == LOCATION_FORWARD) {
        CDRInputStream cdr = (CDRInputStream) istream;
        this.ior = IORFactories.makeIOR( cdr ) ;
    }
}
 
Example 33
Project: openjdk-jdk10   File: POAPolicyMediatorBase_R.java   View source code 5 votes vote down vote up
public Servant deactivateObject( ActiveObjectMap.Key key )
    throws ObjectNotActive, WrongPolicy
{
    if (orb.poaDebugFlag) {
        ORBUtility.dprint( this,
            "Calling deactivateObject for key " + key ) ;
    }

    try {
        AOMEntry entry = activeObjectMap.get(key);
        if (entry == null)
            throw new ObjectNotActive();

        Servant s = activeObjectMap.getServant( entry ) ;
        if (s == null)
            throw new ObjectNotActive();

        if (orb.poaDebugFlag) {
            System.out.println("Deactivating object " + s + " with POA " + poa);
        }

        deactivateHelper( key, entry, s ) ;

        return s ;
    } finally {
        if (orb.poaDebugFlag) {
            ORBUtility.dprint( this,
                "Exiting deactivateObject" ) ;
        }
    }
}
 
Example 34
Project: OpenJSharp   File: ReplyMessage_1_1.java   View source code 5 votes vote down vote up
public void read(org.omg.CORBA.portable.InputStream istream) {
    super.read(istream);
    this.service_contexts
        = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream);
    this.request_id = istream.read_ulong();
    this.reply_status = istream.read_long();
    isValidReplyStatus(this.reply_status); // raises exception on error

    // The code below reads the reply body in some cases
    // SYSTEM_EXCEPTION & LOCATION_FORWARD
    if (this.reply_status == SYSTEM_EXCEPTION) {

        String reposId = istream.read_string();
        this.exClassName = ORBUtility.classNameOf(reposId);
        this.minorCode = istream.read_long();
        int status = istream.read_long();

        switch (status) {
        case CompletionStatus._COMPLETED_YES:
            this.completionStatus = CompletionStatus.COMPLETED_YES;
            break;
        case CompletionStatus._COMPLETED_NO:
            this.completionStatus = CompletionStatus.COMPLETED_NO;
            break;
        case CompletionStatus._COMPLETED_MAYBE:
            this.completionStatus = CompletionStatus.COMPLETED_MAYBE;
            break;
        default:
            throw wrapper.badCompletionStatusInReply(
                CompletionStatus.COMPLETED_MAYBE, new Integer(status) );
        }
    } else if (this.reply_status == USER_EXCEPTION) {
        // do nothing. The client stub will read the exception from body.
    } else if (this.reply_status == LOCATION_FORWARD) {
        CDRInputStream cdr = (CDRInputStream) istream;
        this.ior = IORFactories.makeIOR(cdr) ;
    }
}
 
Example 35
Project: OpenJSharp   File: ReentrantMutex.java   View source code 5 votes vote down vote up
public void acquire() throws InterruptedException {
    if (Thread.interrupted())
        throw new InterruptedException();

    synchronized(this) {
        try {
            if (debug)
                ORBUtility.dprintTrace( this,
                    "acquire enter: holder_=" +
                    ORBUtility.getThreadName(holder_) +
                    " counter_=" + counter_ ) ;

            Thread thr = Thread.currentThread();
            if (holder_ != thr) {
                try {
                    while (counter_ > 0)
                        wait();

                    // This can't happen, but make sure anyway
                    if (counter_ != 0)
                        throw new INTERNAL(
                            "counter not 0 when first acquiring mutex" ) ;

                    holder_ = thr;
                } catch (InterruptedException ex) {
                    notify();
                    throw ex;
                }
            }

            counter_ ++ ;
        } finally {
            if (debug)
                ORBUtility.dprintTrace( this, "acquire exit: holder_=" +
                ORBUtility.getThreadName(holder_) + " counter_=" +
                counter_ ) ;
        }
    }
}
 
Example 36
Project: openjdk-jdk10   File: ReplyMessage_1_0.java   View source code 5 votes vote down vote up
public void read(org.omg.CORBA.portable.InputStream istream) {
    super.read(istream);
    this.service_contexts
        = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream);
    this.request_id = istream.read_ulong();
    this.reply_status = istream.read_long();
    isValidReplyStatus(this.reply_status); // raises exception on error

    // The code below reads the reply body in some cases
    // SYSTEM_EXCEPTION & LOCATION_FORWARD
    if (this.reply_status == SYSTEM_EXCEPTION) {

        String reposId = istream.read_string();
        this.exClassName = ORBUtility.classNameOf(reposId);
        this.minorCode = istream.read_long();
        int status = istream.read_long();

        switch (status) {
        case CompletionStatus._COMPLETED_YES:
            this.completionStatus = CompletionStatus.COMPLETED_YES;
            break;
        case CompletionStatus._COMPLETED_NO:
            this.completionStatus = CompletionStatus.COMPLETED_NO;
            break;
        case CompletionStatus._COMPLETED_MAYBE:
            this.completionStatus = CompletionStatus.COMPLETED_MAYBE;
            break;
        default:
            throw wrapper.badCompletionStatusInReply(
                CompletionStatus.COMPLETED_MAYBE, new Integer(status) );
        }

    } else if (this.reply_status == USER_EXCEPTION) {
        // do nothing. The client stub will read the exception from body.
    } else if (this.reply_status == LOCATION_FORWARD) {
        CDRInputStream cdr = (CDRInputStream) istream;
        this.ior = IORFactories.makeIOR( cdr ) ;
    }
}
 
Example 37
Project: openjdk-jdk10   File: ForwardException.java   View source code 5 votes vote down vote up
public synchronized IOR getIOR()
{
    if (ior == null) {
        ior = ORBUtility.getIOR( obj ) ;
    }

    return ior ;
}
 
Example 38
Project: OpenJSharp   File: POAImpl.java   View source code 5 votes vote down vote up
private boolean destroyIfNotInitDone()
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Calling destroyIfNotInitDone on poa " + this ) ;
        }

        boolean success = (state == STATE_INIT_DONE) ;

        if (success)
            state = STATE_RUN ;
        else {
            // Don't just use destroy, because the check for
            // deadlock is too general, and can prevent this from
            // functioning properly.
            DestroyThread destroyer = new DestroyThread( false, debug );
            destroyer.doIt( this, true ) ;
        }

        return success ;
    } finally {
        adapterActivatorCV.broadcast() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Exiting destroyIfNotInitDone on poa " + this ) ;
        }

        unlock() ;
    }
}
 
Example 39
Project: openjdk-jdk10   File: ForwardException.java   View source code 5 votes vote down vote up
public synchronized org.omg.CORBA.Object getObject()
{
    if (obj == null) {
        obj = ORBUtility.makeObjectReference( ior ) ;
    }

    return obj ;
}
 
Example 40
Project: OpenJSharp   File: POAImpl.java   View source code 5 votes vote down vote up
/**
 * <code>activate_object</code>
 * <b>Section 3.3.8.14</b>
 */
public byte[] activate_object(Servant servant)
    throws ServantAlreadyActive, WrongPolicy
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Calling activate_object on poa " + this +
                " (servant=" + servant + ")" ) ;
        }

        // Allocate a new system-generated object-id.
        // This will throw WrongPolicy if not SYSTEM_ID
        // policy.
        byte[] id = mediator.newSystemId();

        try {
            mediator.activateObject( id, servant ) ;
        } catch (ObjectAlreadyActive oaa) {
            // This exception can not occur in this case,
            // since id is always brand new.
            //
        }

        return id ;
    } finally {
        if (debug) {
            ORBUtility.dprint( this,
                "Exiting activate_object on poa " + this ) ;
        }

        unlock() ;
    }
}