Methods Summary |
---|
public byte[] | activate_object(org.omg.PortableServer.Servant servant)activate_object
Section 3.3.8.14
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() ;
}
|
public void | activate_object_with_id(byte[] id, org.omg.PortableServer.Servant servant)activate_object_with_id
Section 3.3.8.15
try {
lock() ;
if (debug) {
ORBUtility.dprint( this,
"Calling activate_object_with_id on poa " + this +
" (servant=" + servant + " id=" + id + ")" ) ;
}
// Clone the id to avoid possible errors due to aliasing
// (e.g. the client passes the id in and then changes it later).
byte[] idClone = (byte[])(id.clone()) ;
mediator.activateObject( idClone, servant ) ;
} finally {
if (debug) {
ORBUtility.dprint( this,
"Exiting activate_object_with_id on poa " + this ) ;
}
unlock() ;
}
|
public org.omg.PortableServer.POA | create_POA(java.lang.String name, org.omg.PortableServer.POAManager theManager, org.omg.CORBA.Policy[] policies)create_POA
Section 3.3.8.2
try {
lock() ;
if (debug) {
ORBUtility.dprint( this, "Calling create_POA(name=" + name +
" theManager=" + theManager + " policies=" + policies +
") on poa " + this ) ;
}
// We cannot create children of a POA that is (being) destroyed.
// This has been added to the CORBA 3.0 spec.
if (state > STATE_RUN)
throw omgLifecycleWrapper().createPoaDestroy() ;
POAImpl poa = (POAImpl)(children.get(name)) ;
if (poa == null) {
poa = new POAImpl( name, this, getORB(), STATE_START ) ;
}
try {
poa.lock() ;
if (debug) {
ORBUtility.dprint( this,
"Calling create_POA: new poa is " + poa ) ;
}
if ((poa.state != STATE_START) && (poa.state != STATE_INIT))
throw new AdapterAlreadyExists();
POAManagerImpl newManager = (POAManagerImpl)theManager ;
if (newManager == null)
newManager = new POAManagerImpl( manager.getFactory(),
manager.getPIHandler() );
int defaultCopierId =
getORB().getCopierManager().getDefaultId() ;
Policies POAPolicies =
new Policies( policies, defaultCopierId ) ;
poa.initialize( newManager, POAPolicies ) ;
return poa;
} finally {
poa.unlock() ;
}
} finally {
unlock() ;
}
|
public org.omg.PortableServer.IdAssignmentPolicy | create_id_assignment_policy(org.omg.PortableServer.IdAssignmentPolicyValue value)create_id_assignment_policy
Section 3.3.8.5
return new IdAssignmentPolicyImpl(value);
|
public org.omg.PortableServer.IdUniquenessPolicy | create_id_uniqueness_policy(org.omg.PortableServer.IdUniquenessPolicyValue value)create_id_uniqueness_policy
Section 3.3.8.5
return new IdUniquenessPolicyImpl(value);
|
public org.omg.PortableServer.ImplicitActivationPolicy | create_implicit_activation_policy(org.omg.PortableServer.ImplicitActivationPolicyValue value)create_implicit_activation_policy
Section 3.3.8.5
return new ImplicitActivationPolicyImpl(value);
|
public org.omg.PortableServer.LifespanPolicy | create_lifespan_policy(org.omg.PortableServer.LifespanPolicyValue value)create_lifespan_policy
Section 3.3.8.5
return new LifespanPolicyImpl(value);
|
public org.omg.CORBA.Object | create_reference(java.lang.String repId)create_reference
3.3.8.17
try {
lock() ;
if (debug) {
ORBUtility.dprint( this, "Calling create_reference(repId=" +
repId + ") on poa " + this ) ;
}
return makeObject( repId, mediator.newSystemId()) ;
} finally {
unlock() ;
}
|
public org.omg.CORBA.Object | create_reference_with_id(byte[] oid, java.lang.String repId)create_reference_with_id
3.3.8.18
try {
lock() ;
if (debug) {
ORBUtility.dprint( this,
"Calling create_reference_with_id(oid=" +
oid + " repId=" + repId + ") on poa " + this ) ;
}
// Clone the id to avoid possible errors due to aliasing
// (e.g. the client passes the id in and then changes it later).
byte[] idClone = (byte[])(oid.clone()) ;
return makeObject( repId, idClone ) ;
} finally {
unlock() ;
}
|
public org.omg.PortableServer.RequestProcessingPolicy | create_request_processing_policy(org.omg.PortableServer.RequestProcessingPolicyValue value)create_request_processing_policy
Section 3.3.8.5
return new RequestProcessingPolicyImpl(value);
|
public org.omg.PortableServer.ServantRetentionPolicy | create_servant_retention_policy(org.omg.PortableServer.ServantRetentionPolicyValue value)create_servant_retention_policy
Section 3.3.8.5
return new ServantRetentionPolicyImpl(value);
|
public org.omg.PortableServer.ThreadPolicy | create_thread_policy(org.omg.PortableServer.ThreadPolicyValue value)create_thread_policy
Section 3.3.8.5
return new ThreadPolicyImpl(value);
|
public void | deactivate_object(byte[] id)deactivate_object
3.3.8.16
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() ;
}
|
public void | destroy(boolean etherealize, boolean wait_for_completion)destroy
Section 3.3.8.4
// This is to avoid deadlock
if (wait_for_completion && getORB().isDuringDispatch()) {
throw lifecycleWrapper().destroyDeadlock() ;
}
DestroyThread destroyer = new DestroyThread( etherealize, debug );
destroyer.doIt( this, wait_for_completion ) ;
|
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() ;
}
|
public void | enter()
try {
lock() ;
if (debug) {
ORBUtility.dprint( this, "Calling enter on poa " + this ) ;
}
// Avoid deadlock if this is the thread that is processing the
// POA.destroy because this is the only thread that can notify
// waiters on beingDestroyedCV. This can happen if an
// etherealize upcall invokes a method on a colocated object
// served by this POA.
while ((state == STATE_DESTROYING) &&
(isDestroying.get() == Boolean.FALSE)) {
try {
beingDestroyedCV.await();
} catch (InterruptedException ex) {
// NO-OP
}
}
if (!waitUntilRunning())
throw new OADestroyed() ;
invocationCount++;
} finally {
if (debug) {
ORBUtility.dprint( this, "Exiting enter on poa " + this ) ;
}
unlock() ;
}
manager.enter();
|
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() ;
}
|
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();
|
public org.omg.PortableServer.POA | find_POA(java.lang.String name, boolean activate)find_POA
Section 3.3.8.3
POAImpl found = null ;
AdapterActivator act = null ;
lock() ;
if (debug) {
ORBUtility.dprint( this, "Calling find_POA(name=" + name +
" activate=" + activate + ") on poa " + this ) ;
}
found = (POAImpl) children.get(name);
if (found != null) {
if (debug) {
ORBUtility.dprint( this,
"Calling find_POA: found poa " + found ) ;
}
try {
found.lock() ;
// Do not hold the parent POA lock while
// waiting for child to complete initialization.
unlock() ;
// Make sure that the child has completed its initialization,
// if it was created by an AdapterActivator, otherwise throw
// a standard TRANSIENT exception with minor code 4 (see
// CORBA 3.0 11.3.9.3, in reference to unknown_adapter)
if (!found.waitUntilRunning())
throw omgLifecycleWrapper().poaDestroyed() ;
// Note that found may be in state DESTROYING or DESTROYED at
// this point. That's OK, since destruction could start at
// any time.
} finally {
found.unlock() ;
}
} else {
try {
if (debug) {
ORBUtility.dprint( this,
"Calling find_POA: no poa found" ) ;
}
if (activate && (activator != null)) {
// Create a child, but don't initialize it. The newly
// created POA will be in state STATE_START, which will
// cause other calls to find_POA that are creating the same
// POA to block on the waitUntilRunning call above.
// Initialization must be completed by a call to create_POA
// inside the unknown_adapter upcall. Note that
// this.poaMutex must be held here so that this.children
// can be safely updated. The state is set to STATE_INIT
// so that initialize can make the correct state transition
// when create_POA is called inside the AdapterActivator.
// This avoids activating the new POA too soon
// by transitioning to STATE_RUN after unknown_adapter
// returns.
found = new POAImpl( name, this, getORB(), STATE_INIT ) ;
if (debug) {
ORBUtility.dprint( this,
"Calling find_POA: created poa " + found ) ;
}
act = activator ;
} else {
throw new AdapterNonExistent();
}
} finally {
unlock() ;
}
}
// assert (found != null)
// assert not holding this.poaMutex OR found.poaMutex
// We must not hold either this.poaMutex or found.poaMutex here while
// waiting for intialization of found to complete to prevent possible
// deadlocks.
if (act != null) {
boolean status = false ;
boolean adapterResult = false ;
if (debug) {
ORBUtility.dprint( this,
"Calling find_POA: calling AdapterActivator" ) ;
}
try {
// Prevent more than one thread at a time from executing in act
// in case act is shared between multiple POAs.
synchronized (act) {
status = act.unknown_adapter(this, name);
}
} catch (SystemException exc) {
throw omgLifecycleWrapper().adapterActivatorException( exc,
name, poaId.toString() ) ;
} catch (Throwable thr) {
// ignore most non-system exceptions, but log them for
// diagnostic purposes.
lifecycleWrapper().unexpectedException( thr, this.toString() ) ;
if (thr instanceof ThreadDeath)
throw (ThreadDeath)thr ;
} finally {
// At this point, we have completed adapter activation.
// Whether this was successful or not, we must call
// destroyIfNotInitDone so that calls to enter() and create_POA()
// that are waiting can execute again. Failing to do this
// will cause the system to hang in complex tests.
adapterResult = found.destroyIfNotInitDone() ;
}
if (status) {
if (!adapterResult)
throw omgLifecycleWrapper().adapterActivatorException( name,
poaId.toString() ) ;
} else {
if (debug) {
ORBUtility.dprint( this,
"Calling find_POA: AdapterActivator returned false" ) ;
}
// OMG Issue 3740 is resolved to throw AdapterNonExistent if
// unknown_adapter() returns false.
throw new AdapterNonExistent();
}
}
return found;
|
boolean | getDebug()
return debug ;
|
public org.omg.CORBA.Policy | getEffectivePolicy(int type)
return mediator.getPolicies().get_effective_policy( type ) ;
|
public java.lang.String[] | getInterfaces(java.lang.Object servant, byte[] objectId)
Servant serv = (Servant)servant ;
return serv._all_interfaces( this, objectId ) ;
|
public void | getInvocationServant(com.sun.corba.se.spi.oa.OAInvocationInfo info)
try {
lock() ;
if (debug) {
ORBUtility.dprint( this,
"Calling getInvocationServant on poa " + this ) ;
}
java.lang.Object servant = null ;
try {
servant = mediator.getInvocationServant( info.id(),
info.getOperation() );
} catch (ForwardRequest freq) {
throw new ForwardException( getORB(), freq.forward_reference ) ;
}
info.setServant( servant ) ;
} finally {
if (debug) {
ORBUtility.dprint( this,
"Exiting getInvocationServant on poa " + this ) ;
}
unlock() ;
}
|
public org.omg.CORBA.Object | getLocalServant(byte[] objectId)
return null ;
|
public int | getManagerId()
return manager.getManagerId() ;
|
protected com.sun.corba.se.spi.copyobject.ObjectCopierFactory | getObjectCopierFactory()
int copierId = mediator.getPolicies().getCopierId() ;
CopierManager cm = getORB().getCopierManager() ;
return cm.getObjectCopierFactory( copierId ) ;
|
static POAFactory | getPOAFactory(com.sun.corba.se.spi.orb.ORB orb)
return (POAFactory)orb.getRequestDispatcherRegistry().
getObjectAdapterFactory( ORBConstants.TRANSIENT_SCID ) ;
|
int | getPOAId()
return uniquePOAId ;
|
Policies | getPolicies()
return mediator.getPolicies() ;
|
public short | getState()
return manager.getORTState() ;
|
public org.omg.PortableServer.Servant | get_servant()get_servant
Section 3.3.8.12
try {
lock() ;
return mediator.getDefaultServant() ;
} finally {
unlock() ;
}
|
public org.omg.PortableServer.ServantManager | get_servant_manager()get_servant_manager
Section 3.3.8.10
try {
lock() ;
return mediator.getServantManager() ;
} finally {
unlock() ;
}
|
public byte[] | id()id
11.3.8.26 in ptc/00-08-06
try {
lock() ;
return getAdapterId() ;
} finally {
unlock() ;
}
|
public org.omg.CORBA.Object | id_to_reference(byte[] id)id_to_reference
3.3.8.24
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() ;
}
|
public org.omg.PortableServer.Servant | id_to_servant(byte[] id)id_to_servant
3.3.8.23
try {
lock() ;
if (debug) {
ORBUtility.dprint( this, "Calling id_to_servant(id=" +
id + ") on poa " + this ) ;
}
if( state >= STATE_DESTROYING ) {
throw lifecycleWrapper().adapterDestroyed() ;
}
return mediator.idToServant( id ) ;
} finally {
unlock() ;
}
|
private void | initialize(POAManagerImpl manager, Policies policies)
if (debug) {
ORBUtility.dprint( this, "Initializing poa " + this +
" with POAManager=" + manager + " policies=" + policies ) ;
}
this.manager = manager;
manager.addPOA(this);
mediator = POAPolicyMediatorFactory.create( policies, this ) ;
// Construct the object key template
int serverid = mediator.getServerId() ;
int scid = mediator.getScid() ;
String orbId = getORB().getORBData().getORBId();
ObjectKeyTemplate oktemp = new POAObjectKeyTemplate( getORB(),
scid, serverid, orbId, poaId ) ;
if (debug) {
ORBUtility.dprint( this, "Initializing poa: oktemp=" + oktemp ) ;
}
// Note that parent == null iff this is the root POA.
// This was used to avoid executing interceptors on the RootPOA.
// That is no longer necessary.
boolean objectAdapterCreated = true; // parent != null ;
// XXX extract codebase from policies and pass into initializeTemplate
// after the codebase policy change is finalized.
initializeTemplate( oktemp, objectAdapterCreated,
policies,
null, // codebase
null, // manager id
oktemp.getObjectAdapterId()
) ;
if (state == STATE_START)
state = STATE_RUN ;
else if (state == STATE_INIT)
state = STATE_INIT_DONE ;
else
throw lifecycleWrapper().illegalPoaStateTrans() ;
|
private byte[] | internalReferenceToId(org.omg.CORBA.Object reference)
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();
|
void | lock()
SyncUtil.acquire( poaMutex ) ;
if (debug) {
ORBUtility.dprint( this, "LOCKED poa " + this ) ;
}
|
static com.sun.corba.se.impl.oa.poa.POAImpl | makeRootPOA(com.sun.corba.se.spi.orb.ORB orb)
POAManagerImpl poaManager = new POAManagerImpl( getPOAFactory( orb ),
orb.getPIHandler() ) ;
POAImpl result = new POAImpl( ORBConstants.ROOT_POA_NAME,
null, orb, STATE_START ) ;
result.initialize( poaManager, Policies.rootPOAPolicies ) ;
return result ;
|
public byte[] | reference_to_id(org.omg.CORBA.Object reference)reference_to_id
3.3.8.22
try {
lock() ;
if (debug) {
ORBUtility.dprint( this, "Calling reference_to_id(reference=" +
reference + ") on poa " + this ) ;
}
if( state >= STATE_DESTROYING ) {
throw lifecycleWrapper().adapterDestroyed() ;
}
return internalReferenceToId( reference ) ;
} finally {
unlock() ;
}
|
public org.omg.PortableServer.Servant | reference_to_servant(org.omg.CORBA.Object reference)reference_to_servant
3.3.8.21
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() ;
}
|
public void | returnServant()Called from the subcontract to let this POA cleanup after an
invocation. Note: If getServant was called, then returnServant
MUST be called, even in the case of exceptions. This may be
called multiple times for a single request.
try {
lock() ;
if (debug) {
ORBUtility.dprint( this,
"Calling returnServant on poa " + this ) ;
}
mediator.returnServant();
} catch (Throwable thr) {
if (debug) {
ORBUtility.dprint( this,
"Exception " + thr + " in returnServant on poa " + this ) ;
}
if (thr instanceof Error)
throw (Error)thr ;
else if (thr instanceof RuntimeException)
throw (RuntimeException)thr ;
} finally {
if (debug) {
ORBUtility.dprint( this,
"Exiting returnServant on poa " + this ) ;
}
unlock() ;
}
|
public byte[] | servant_to_id(org.omg.PortableServer.Servant servant)servant_to_id
3.3.8.19
try {
lock() ;
if (debug) {
ORBUtility.dprint( this, "Calling servant_to_id(servant=" +
servant + ") on poa " + this ) ;
}
return mediator.servantToId( servant ) ;
} finally {
unlock() ;
}
|
public org.omg.CORBA.Object | servant_to_reference(org.omg.PortableServer.Servant servant)servant_to_reference
3.3.8.20
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() ;
}
|
public void | set_servant(org.omg.PortableServer.Servant defaultServant)set_servant
Section 3.3.8.13
try {
lock() ;
if (debug) {
ORBUtility.dprint( this, "Calling set_servant on poa " +
this + " defaultServant=" + defaultServant ) ;
}
mediator.setDefaultServant( defaultServant ) ;
} finally {
unlock() ;
}
|
public void | set_servant_manager(org.omg.PortableServer.ServantManager servantManager)set_servant_manager
Section 3.3.8.10
try {
lock() ;
if (debug) {
ORBUtility.dprint( this, "Calling set_servant_manager on poa " +
this + " servantManager=" + servantManager ) ;
}
mediator.setServantManager( servantManager ) ;
} finally {
unlock() ;
}
|
private java.lang.String | stateToString() // destruction complete
switch (state) {
case STATE_START :
return "START" ;
case STATE_INIT :
return "INIT" ;
case STATE_INIT_DONE :
return "INIT_DONE" ;
case STATE_RUN :
return "RUN" ;
case STATE_DESTROYING :
return "DESTROYING" ;
case STATE_DESTROYED :
return "DESTROYED" ;
default :
return "UNKNOWN(" + state + ")" ;
}
|
public org.omg.PortableServer.POAManager | the_POAManager()the_POAManager
Section 3.3.8.8
try {
lock() ;
return manager;
} finally {
unlock() ;
}
|
public org.omg.PortableServer.AdapterActivator | the_activator()the_activator
Section 3.3.8.9
try {
lock() ;
return activator;
} finally {
unlock() ;
}
|
public void | the_activator(org.omg.PortableServer.AdapterActivator activator)the_activator
Section 3.3.8.9
try {
lock() ;
if (debug) {
ORBUtility.dprint( this, "Calling the_activator on poa " +
this + " activator=" + activator ) ;
}
this.activator = activator;
} finally {
unlock() ;
}
|
public org.omg.PortableServer.POA[] | the_children()the_children
try {
lock() ;
Collection coll = children.values() ;
int size = coll.size() ;
POA[] result = new POA[ size ] ;
int index = 0 ;
Iterator iter = coll.iterator() ;
while (iter.hasNext()) {
POA poa = (POA)(iter.next()) ;
result[ index++ ] = poa ;
}
return result ;
} finally {
unlock() ;
}
|
public java.lang.String | the_name()the_name
Section 3.3.8.6
try {
lock() ;
return name;
} finally {
unlock() ;
}
|
public org.omg.PortableServer.POA | the_parent()the_parent
Section 3.3.8.7
try {
lock() ;
return parent;
} finally {
unlock() ;
}
|
public java.lang.String | toString()
return "POA[" + poaId.toString() +
", uniquePOAId=" + uniquePOAId +
", state=" + stateToString() +
", invocationCount=" + invocationCount + "]" ;
|
void | unlock()
if (debug) {
ORBUtility.dprint( this, "UNLOCKED poa " + this ) ;
}
poaMutex.release() ;
|
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) ;
|