本文整理汇总了Java中org.omg.PortableServer.POAManagerPackage.State类的典型用法代码示例。如果您正苦于以下问题:Java State类的具体用法?Java State怎么用?Java State使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
State类属于org.omg.PortableServer.POAManagerPackage包,在下文中一共展示了State类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkState
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
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() ;
}
}
}
示例2: deactivate
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
/**
*
* Turns the asociated POAs into inactive state. The POAs in the incative
* state will reject new requests. If the POA is once inactivated, it
* cannot be activated again. The operation is used when
* the associated POAs are to be shut down.
*
* @param etherealize_objects if true, the servant managers of the
* associated POAs, having RETAIN and USE_SERVANT_MANAGER policies,
* will receive a call of {@link ServantActivatorOperations#etherealize}.
*
* @param wait_for_completion if true, the method call suspends the current
* thread till POAs complete the requests they are currently processing. If
* false, the method returns immediately.
*
* @throws AdapterInactive if the POAs are already in the inactive state.
*
* @see POAOperations#destroy
*/
public void deactivate(boolean etherealize_objects,
boolean wait_for_completion
)
throws AdapterInactive
{
if (state == State.INACTIVE)
throw new AdapterInactive("Repetetive inactivation");
state = State.INACTIVE;
notifyInterceptors(state.value());
if (wait_for_completion)
waitForIdle();
Iterator iter = POAs.iterator();
while (iter.hasNext())
{
gnuPOA poa = (gnuPOA) iter.next();
// If the servant activator is non null, this means it has been
// set - hence the policies are appropriate.
if (poa.servant_activator != null)
poa.etherealizeAll();
}
}
示例3: deactivate
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
/**
*
* Turns the asociated POAs into inactive state. The POAs in the incative
* state will reject new requests. If the POA is once inactivated, it
* cannot be activated again. The operation is used when
* the associated POAs are to be shut down.
*
* @param etherealize_objects if true, the servant managers of the
* associated POAs, having RETAIN and USE_SERVANT_MANAGER policies,
* will receive a call of {@link ServantActivatorOperations#etherealize}.
*
* @param wait_for_completion if true, the method call suspends the current
* thread till POAs complete the requests they are currently processing. If
* false, the method returns immediately.
*
* @throws AdapterInactive if the POAs are already in the inactive state.
*
* @see POAOperations#destroy
*/
public void deactivate(boolean etherealize_objects,
boolean wait_for_completion
)
throws AdapterInactive
{
if (state == State.INACTIVE)
throw new AdapterInactive("Repetetive inactivation");
state = State.INACTIVE;
notifyInterceptors(state.value());
if (wait_for_completion)
waitForIdle();
Iterator iter = POAs.iterator();
while (iter.hasNext())
{
gnuPOA poa = (gnuPOA) iter.next();
// If the servant activator is non null, this means it has been
// set - hence the policies are appropriate.
if (poa.servant_activator != null)
poa.etherealizeAll();
}
}
示例4: POAManagerImpl
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
/**
* Constructor.
*
* @param orb
* The ORB.
*/
public POAManagerImpl(es.tid.TIDorbj.core.TIDORB orb)
{
m_orb = orb;
synchronized (orb.m_POAManagers) {
orb.m_POAManagers.addElement(this);
}
m_manager_name = "POAManager " + st_serial.inc();
m_state = State.HOLDING;
m_state_mutex = new Boolean(true);
m_conf = new POAManagerConf(orb.m_conf.poa_min_threads,
orb.m_conf.poa_max_threads,
orb.m_conf.poa_max_queued_requests,
orb.m_conf.poa_starving_time);
m_completion = new CompletionWaiter(orb);
m_poas = new Vector();
m_pool = new ThreadPool(this);
m_conf.setListener(m_pool);
m_request_queue = new RequestQueue(this, m_pool, new TemporalRequestComparator());
m_pool.minThreadsHasChanged();
m_queue_order = ORDER_TEMPORAL.value;
}
示例5: activate
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
/**
* This operation changes the POA manager to ACTIVE.
*
* @exception org.omg.PortableServer.POAManagerPackage.AdapterInactive
* If POA manager state is INACTIVE.
*/
public void activate()
throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
{
// State change -> ACTIVE
synchronized (m_state_mutex) {
if (m_state == State.INACTIVE) {
throw new AdapterInactive();
}
if (m_state != State.ACTIVE) {
m_completion.stopWaiting();
m_state = State.ACTIVE;
m_state_mutex.notifyAll();
}
}
}
示例6: hold_requests
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
/**
* This operation changes the POA manager to HOLDING.
*
* @param wait_for_completion
* Wait-for-completion flag.
* @exception org.omg.PortableServer.POAManagerPackage.AdapterInactive
* If POA manager state is INACTIVE.
*/
public void hold_requests(boolean wait_for_completion)
throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
{
// State change -> HOLDING
synchronized (m_state_mutex) {
if (m_state == State.INACTIVE) {
throw new AdapterInactive();
}
if (m_state != State.HOLDING) {
m_completion.stopWaiting();
m_state = State.HOLDING;
m_state_mutex.notifyAll();
}
}
// Wait for completion, if necessary
if (wait_for_completion && m_completion.conditionToWait()) {
m_completion.waitForCompletion(); // synchronized
}
}
示例7: discard_requests
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
/**
* This operation changes the POA manager to DISCARDING.
*
* @param wait_for_completion
* Wait-for-completion flag.
* @exception org.omg.PortableServer.POAManagerPackage.AdapterInactive
* If POA manager state is INACTIVE.
*/
public void discard_requests(boolean wait_for_completion)
throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
{
// State change -> DISCARDING
synchronized (m_state_mutex) {
if (m_state == State.INACTIVE) {
throw new AdapterInactive();
}
if (m_state != State.DISCARDING) {
m_completion.stopWaiting();
m_state = State.DISCARDING;
m_state_mutex.notifyAll();
}
}
// Wait for completion, if necessary
if (wait_for_completion && m_completion.conditionToWait()) {
m_completion.waitForCompletion(); // synchronized
}
}
示例8: stateToString
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
private String stateToString( State state )
{
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]" ;
}
示例9: POAManagerImpl
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
POAManagerImpl( POAFactory factory, PIHandler pihandler )
{
this.factory = factory ;
factory.addPoaManager(this);
this.pihandler = pihandler ;
myId = factory.newPOAManagerId() ;
state = State.HOLDING;
debug = factory.getORB().poaDebugFlag ;
explicitStateChange = false ;
if (debug) {
ORBUtility.dprint( this, "Creating POAManagerImpl " + this ) ;
}
}
示例10: addPOA
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
synchronized void addPOA(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);
}
示例11: getORTState
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
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 ;
}
}
示例12: activate
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
/**
* <code>activate</code>
* <b>Spec: pages 3-14 thru 3-18</b>
*/
public synchronized void activate()
throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
{
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 ) ;
}
}
}
示例13: hold_requests
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
/**
* <code>hold_requests</code>
* <b>Spec: pages 3-14 thru 3-18</b>
*/
public synchronized void hold_requests(boolean wait_for_completion)
throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
{
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 ) ;
}
}
}
示例14: discard_requests
import org.omg.PortableServer.POAManagerPackage.State; //导入依赖的package包/类
/**
* <code>discard_requests</code>
* <b>Spec: pages 3-14 thru 3-18</b>
*/
public synchronized void discard_requests(boolean wait_for_completion)
throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
{
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 ) ;
}
}
}