use of org.omg.PortableServer.POAManagerPackage.AdapterInactive in project narayana by jbosstm.
the class jacorb_2_0 method createPOA.
public void createPOA(String adapterName, Policy[] policies) throws AdapterAlreadyExists, InvalidPolicy, AdapterInactive, SystemException {
if (_poa == null) {
opLogger.i18NLogger.warn_internal_orbspecific_oa_implementations("jacorb_2_0.createPOA");
throw new AdapterInactive();
}
POA childPoa = _poa.create_POA(adapterName, _poa.the_POAManager(), policies);
childPoa.the_POAManager().activate();
super._poas.put(adapterName, childPoa);
}
use of org.omg.PortableServer.POAManagerPackage.AdapterInactive in project ACS by ACS-Community.
the class CharacteristicModelImpl method get_all_characteristics.
/**
* @see alma.ACS.CharacteristicModelOperations#get_all_characteristics()
*/
public PropertySet get_all_characteristics() {
String[] allSeq;
try {
if (prefix == "")
allSeq = dao.get_string_seq("");
else
allSeq = dao.get_string_seq(prefix);
Property[] p = new Property[allSeq.length];
for (int i = 0; i < allSeq.length; i++) {
Any a = get_characteristic_by_name(allSeq[i]);
p[i] = new Property(allSeq[i], a);
}
//dangerous methods!!
ORB orb = m_container.getAdvancedContainerServices().getORB();
POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
rootpoa.the_POAManager().activate();
PropertySetImpl psetImpl = new PropertySetImpl(p);
PropertySetPOATie psetTie = new PropertySetPOATie(psetImpl, rootpoa);
return psetTie._this(orb);
} catch (CDBFieldDoesNotExistEx e) {
} catch (WrongCDBDataTypeEx e) {
} catch (NoSuchCharacteristic e) {
} catch (MultipleExceptions e) {
} catch (InvalidName e) {
} catch (AdapterInactive e) {
} catch (NullPointerException e) {
System.out.println(e);
}
throw new NO_IMPLEMENT();
}
use of org.omg.PortableServer.POAManagerPackage.AdapterInactive in project ACS by ACS-Community.
the class AcsCorba method deactivateComponentPOAManager.
/**
* Deactivates a component's POA manager.
* The effect is that no further calls will reach the component.
* This method returns immediately if the POA manager is already inactive.
* Otherwise it will only return when the active requests are done.
* <p>
* Note for JacORB (1.4 as well as 2.2.4): there seems to be a problem in
* <code>org.jacorb.poa.RequestController#waitForCompletion</code> with local calls (e.g. collocated component).
* Instead of duly waiting for completion, that method returns immediately when such calls are still executing.
* Even worse, <code>RequestController#activeRequestTable</code> seems to never get touched in case of local calls.
* There is a currently commented out JUnit test that verifies this problem.
* <p>
* The purpose of this method is to allow the container to "drain" a component of requests,
* so that <code>cleanUp</code> can be called while no functional calls are running or can come in.
* An alternative to using the component POA manager could be to destroy the component POA before
* calling <code>cleanUp</code>. This has the disadvantage of also destroying the offshoot child POA,
* which is needed to properly clean up callback connections.
* <p>
* Note that {@link POAManager#deactivate(boolean, boolean)} is called in a separate thread,
* so that this method itself may well be called from an ORB thread.
* This method uses <code>etherealize_objects=false</code> and <code>wait_for_completion=true</code>.
*
* @param compPOA the component POA
* @param compName component instance name
* @param timeoutMillis timeout in milliseconds after which this call returns even if the POA manager is not inactive yet.
* @return true if the POA manager is inactive.
*/
public boolean deactivateComponentPOAManager(POA compPOA, final String compName, int timeoutMillis) {
final POAManager compPOAManager = compPOA.the_POAManager();
if (compPOAManager.get_state() == State.INACTIVE) {
return true;
}
final CountDownLatch deactivateSyncer = new CountDownLatch(1);
// todo: use thread pool instead of always creating a thread for this purpose
Thread discardRequestsThread = new Thread(new Runnable() {
public void run() {
try {
// note that deactivate(wait_for_completion=true) must not be called from an ORB thread,
// thus we use a separate thread here. This is quite annoying because
// at least in JacORB's implementation, another new thread is created inside deactivate
compPOAManager.deactivate(false, true);
// compPOAManager.discard_requests(true);
deactivateSyncer.countDown();
} catch (AdapterInactive e) {
m_logger.log(Level.INFO, "Failed to finish and reject requests for component " + compName, e);
}
}
});
discardRequestsThread.setDaemon(true);
discardRequestsThread.setName("deactivatePOAManager_" + compName);
StopWatch stopWatch = null;
if (m_logger.isLoggable(Level.FINEST)) {
stopWatch = new StopWatch();
}
discardRequestsThread.start();
boolean isInactive = false;
try {
isInactive = deactivateSyncer.await(timeoutMillis, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
// isInactive == false
} finally {
if (m_logger.isLoggable(Level.FINEST)) {
long deactivationTime = stopWatch.getLapTimeMillis();
String msg = "POA manager deactivation for component '" + compName + "' was " + (isInactive ? "" : "*not* ") + "successful and took " + deactivationTime + " ms. " + "The component can" + (isInactive ? "not" : "") + " receive further calls over CORBA.";
m_logger.finest(msg);
}
}
return isInactive;
}
use of org.omg.PortableServer.POAManagerPackage.AdapterInactive in project narayana by jbosstm.
the class ibmorb_7_1 method createPOA.
/**
* Create a child POA of the root POA.
*/
public void createPOA(String adapterName, Policy[] policies) throws AdapterAlreadyExists, InvalidPolicy, AdapterInactive, SystemException {
if (_poa == null) {
opLogger.i18NLogger.warn_internal_orbspecific_oa_implementations("javaidl_1_4.createPOA");
throw new AdapterInactive();
}
POA childPoa = _poa.create_POA(adapterName, _poa.the_POAManager(), policies);
childPoa.the_POAManager().activate();
super._poas.put(adapterName, childPoa);
}
use of org.omg.PortableServer.POAManagerPackage.AdapterInactive in project alliance by codice.
the class OrderMgrImplTest method setUp.
@Before
public void setUp() throws Exception {
setupCommonMocks();
setupOrderMgrMocks();
try {
setupOrb();
orbRunThread = new Thread(() -> orb.run());
orbRunThread.start();
} catch (InvalidName | AdapterInactive | WrongPolicy | ServantNotActive e) {
LOGGER.error("Unable to start the CORBA server", e);
} catch (IOException e) {
LOGGER.error("Unable to generate the IOR file", e);
} catch (SecurityServiceException e) {
LOGGER.error("Unable to setup guest security credentials", e);
}
String managerId = UUID.randomUUID().toString();
orderMgr = new OrderMgrImpl();
orderMgr.setFilterBuilder(new GeotoolsFilterBuilder());
orderMgr.setCatalogFramework(mockCatalogFramework);
if (!CorbaUtils.isIdActive(rootPOA, managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)))) {
try {
rootPOA.activate_object_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), orderMgr);
} catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
LOGGER.error("Error activating ProductMgr: {}", e);
}
}
rootPOA.create_reference_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), ProductMgrHelper.id());
}
Aggregations