Methods Summary |
---|
public synchronized void | activate()activate
Spec: pages 3-14 thru 3-18
explicitStateChange = true ;
if (debug) {
ORBUtility.dprint( this,
"Calling activate on POAManager " + this ) ;
}
try {
if ( state.value() == State._INACTIVE )
throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
// set the state to ACTIVE
state = State.ACTIVE;
pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
// Notify any invocations that were waiting because the previous
// state was HOLDING, as well as notify any threads that were waiting
// inside hold_requests() or discard_requests().
notifyWaiters();
} finally {
if (debug) {
ORBUtility.dprint( this,
"Exiting activate on POAManager " + this ) ;
}
}
|
synchronized void | addPOA(org.omg.PortableServer.POA poa)
// XXX This is probably not the correct error
if (state.value() == State._INACTIVE) {
POASystemException wrapper = factory.getWrapper();
throw wrapper.addPoaInactive( CompletionStatus.COMPLETED_NO ) ;
}
poas.add(poa);
|
synchronized void | checkIfActive()The following methods are used on the invocation path.
try {
if (debug) {
ORBUtility.dprint( this,
"Calling checkIfActive for POAManagerImpl " + this ) ;
}
checkState();
} finally {
if (debug) {
ORBUtility.dprint( this,
"Exiting checkIfActive for POAManagerImpl " + this ) ;
}
}
|
private void | checkState()
while ( state.value() != State._ACTIVE ) {
switch ( state.value() ) {
case State._HOLDING:
while ( state.value() == State._HOLDING ) {
countedWait() ;
}
break;
case State._DISCARDING:
throw factory.getWrapper().poaDiscarding() ;
case State._INACTIVE:
throw factory.getWrapper().poaInactive() ;
}
}
|
private void | countedWait()
try {
if (debug) {
ORBUtility.dprint( this, "Calling countedWait on POAManager " +
this + " nWaiters=" + nWaiters ) ;
}
nWaiters++ ;
wait();
} catch ( java.lang.InterruptedException ex ) {
// NOP
} finally {
nWaiters-- ;
if (debug) {
ORBUtility.dprint( this, "Exiting countedWait on POAManager " +
this + " nWaiters=" + nWaiters ) ;
}
}
|
public void | deactivate(boolean etherealize_objects, boolean wait_for_completion)deactivate
Spec: pages 3-14 thru 3-18
Note: INACTIVE is a permanent state.
explicitStateChange = true ;
try {
synchronized( this ) {
if (debug) {
ORBUtility.dprint( this,
"Calling deactivate on POAManager " + this ) ;
}
if ( state.value() == State._INACTIVE )
throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
state = State.INACTIVE;
pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
// Notify any invocations that were waiting because the previous
// state was HOLDING. Those invocations will then be rejected with
// an OBJ_ADAPTER exception. Also notify any threads that were waiting
// inside hold_requests() or discard_requests().
notifyWaiters();
}
POAManagerDeactivator deactivator = new POAManagerDeactivator( this,
etherealize_objects, debug ) ;
if (wait_for_completion)
deactivator.run() ;
else {
Thread thr = new Thread(deactivator) ;
thr.start() ;
}
} finally {
synchronized(this) {
if (debug) {
ORBUtility.dprint( this,
"Exiting deactivate on POAManager " + this ) ;
}
}
}
|
public synchronized void | discard_requests(boolean wait_for_completion)discard_requests
Spec: pages 3-14 thru 3-18
explicitStateChange = true ;
if (debug) {
ORBUtility.dprint( this,
"Calling hold_requests on POAManager " + this ) ;
}
try {
if ( state.value() == State._INACTIVE )
throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
// set the state to DISCARDING
state = State.DISCARDING;
pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
// Notify any invocations that were waiting because the previous
// state was HOLDING. Those invocations will henceforth be rejected with
// a TRANSIENT exception. Also notify any threads that were waiting
// inside hold_requests().
notifyWaiters();
if ( wait_for_completion ) {
while ( state.value() == State._DISCARDING && nInvocations > 0 ) {
countedWait() ;
}
}
} finally {
if (debug) {
ORBUtility.dprint( this,
"Exiting hold_requests on POAManager " + this ) ;
}
}
|
synchronized void | enter()
try {
if (debug) {
ORBUtility.dprint( this,
"Calling enter for POAManagerImpl " + this ) ;
}
checkState();
nInvocations++;
} finally {
if (debug) {
ORBUtility.dprint( this,
"Exiting enter for POAManagerImpl " + this ) ;
}
}
|
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 ) ;
}
}
|
POAFactory | getFactory()
return factory ;
|
public int | getManagerId()
return myId ;
|
public short | getORTState()
switch (state.value()) {
case State._HOLDING : return HOLDING.value ;
case State._ACTIVE : return ACTIVE.value ;
case State._INACTIVE : return INACTIVE.value ;
case State._DISCARDING : return DISCARDING.value ;
default : return NON_EXISTENT.value ;
}
|
com.sun.corba.se.spi.protocol.PIHandler | getPIHandler()
return pihandler ;
|
public org.omg.PortableServer.POAManagerPackage.State | get_state()Added according to the spec CORBA V2.3; this returns the
state of the POAManager
return state;
|
public synchronized void | hold_requests(boolean wait_for_completion)hold_requests
Spec: pages 3-14 thru 3-18
explicitStateChange = true ;
if (debug) {
ORBUtility.dprint( this,
"Calling hold_requests on POAManager " + this ) ;
}
try {
if ( state.value() == State._INACTIVE )
throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
// set the state to HOLDING
state = State.HOLDING;
pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
// Notify any threads that were waiting in the wait() inside
// discard_requests. This will cause discard_requests to return
// (which is in conformance with the spec).
notifyWaiters();
if ( wait_for_completion ) {
while ( state.value() == State._HOLDING && nInvocations > 0 ) {
countedWait() ;
}
}
} finally {
if (debug) {
ORBUtility.dprint( this,
"Exiting hold_requests on POAManager " + this ) ;
}
}
|
public synchronized void | implicitActivation()Activate the POAManager if no explicit state change has ever been
previously invoked.
if (!explicitStateChange)
try {
activate() ;
} catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive ai) {
// ignore the exception.
}
|
private void | notifyWaiters()
if (debug) {
ORBUtility.dprint( this, "Calling notifyWaiters on POAManager " +
this + " nWaiters=" + nWaiters ) ;
}
if (nWaiters >0)
notifyAll() ;
|
synchronized void | removePOA(org.omg.PortableServer.POA poa)
poas.remove(poa);
if ( poas.isEmpty() ) {
factory.removePoaManager(this);
}
|
private java.lang.String | stateToString(org.omg.PortableServer.POAManagerPackage.State state) // initially false, set true as soon as
// one of activate, hold_request,
// discard_request, or deactivate is called.
switch (state.value()) {
case State._HOLDING : return "State[HOLDING]" ;
case State._ACTIVE : return "State[ACTIVE]" ;
case State._DISCARDING : return "State[DISCARDING]" ;
case State._INACTIVE : return "State[INACTIVE]" ;
}
return "State[UNKNOWN]" ;
|
public java.lang.String | toString()
return "POAManagerImpl[myId=" + myId +
" state=" + stateToString(state) +
" nInvocations=" + nInvocations +
" nWaiters=" + nWaiters + "]" ;
|