use of org.omg.PortableServer.POAPackage.AdapterAlreadyExists in project ACS by ACS-Community.
the class AlarmSystemContainerServices method getPOAForOffshoots.
public POA getPOAForOffshoots(POA componentPOA) throws AcsJContainerEx, AcsJUnexpectedExceptionEx {
final String offshootPoaName = "offshootPoa";
POA offshootPoa = null;
synchronized (componentPOA) {
try {
// can we reuse it?
offshootPoa = componentPOA.find_POA(offshootPoaName, false);
} catch (AdapterNonExistent e) {
logger.finest("will have to create offshoot POA");
if (m_offshootPolicies == null) {
m_offshootPolicies = new Policy[4];
m_offshootPolicies[0] = componentPOA.create_id_assignment_policy(IdAssignmentPolicyValue.SYSTEM_ID);
m_offshootPolicies[1] = componentPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT);
m_offshootPolicies[2] = componentPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY);
m_offshootPolicies[3] = componentPOA.create_servant_retention_policy(ServantRetentionPolicyValue.RETAIN);
}
try {
offshootPoa = componentPOA.create_POA(offshootPoaName, alSysCorbaServer.getRootPOA().the_POAManager(), m_offshootPolicies);
logger.finest("successfully created offshoot POA");
} catch (InvalidPolicy ex) {
AcsJContainerEx ex2 = new AcsJContainerEx(ex);
ex2.setContextInfo("Attempted to create offshoot POA with invalid policies.");
throw ex2;
} catch (AdapterAlreadyExists ex) {
// we sync on componentPOA, so this should never happen
throw new AcsJUnexpectedExceptionEx(ex);
}
}
}
return offshootPoa;
}
use of org.omg.PortableServer.POAPackage.AdapterAlreadyExists in project ACS by ACS-Community.
the class ManagerContainerServices method checkOffShootPOA.
/**
* Creates the shared offshoot poa on demand
*/
public void checkOffShootPOA() throws AcsJContainerEx, AcsJUnexpectedExceptionEx {
final String offshootPoaName = "offshootPoa";
synchronized (clientPOA) {
try {
// can we reuse it?
offshootPoa = clientPOA.find_POA(offshootPoaName, false);
} catch (AdapterNonExistent e) {
logger.finest("will have to create offshoot POA");
if (offshootPolicies == null) {
offshootPolicies = new Policy[4];
offshootPolicies[0] = clientPOA.create_id_assignment_policy(IdAssignmentPolicyValue.SYSTEM_ID);
offshootPolicies[1] = clientPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT);
offshootPolicies[2] = clientPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY);
offshootPolicies[3] = clientPOA.create_servant_retention_policy(ServantRetentionPolicyValue.RETAIN);
}
try {
offshootPoa = clientPOA.create_POA(offshootPoaName, clientPOA.the_POAManager(), offshootPolicies);
logger.finest("successfully created offshoot POA");
} catch (InvalidPolicy ex) {
AcsJContainerEx ex2 = new AcsJContainerEx(ex);
ex2.setContextInfo("Attempted to create offshoot POA with invalid policies.");
throw ex2;
} catch (AdapterAlreadyExists ex) {
// we sync on componentPOA, so this should never happen
throw new AcsJUnexpectedExceptionEx(ex);
}
}
}
}
use of org.omg.PortableServer.POAPackage.AdapterAlreadyExists in project ACS by ACS-Community.
the class AcsCorba method getPOAForOffshoots.
/**
* Creates (or reuses) the non-persistent POA for offshoot objects as a child of the given POA.
* In spite of the suggestive name 'componentPOA', this POA can actually be any kind of POA,
* so that also client application can use the offshoot mechanism.
* <p>
* This method is synchronized inside to avoid race conditions between several offshoot POA creation/retrievals,
* where otherwise the POA would fail to be created even though first it was not found for reuse.
*
* @param componentPOA the POA of the component that owns the offshoot object;
* will become the parent of the offshoot POA.
* @return POA non-persistent POA for offshoot objects for the current component.
*
* @throws AcsJContainerServicesEx
*/
public POA getPOAForOffshoots(POA componentPOA) throws AcsJContainerEx, AcsJUnexpectedExceptionEx {
final String offshootPoaName = "offshootPoa";
POA offshootPoa = null;
synchronized (componentPOA) {
try {
// can we reuse it?
offshootPoa = componentPOA.find_POA(offshootPoaName, false);
} catch (AdapterNonExistent e) {
m_logger.finest("will have to create offshoot POA");
if (m_offshootPolicies == null) {
m_offshootPolicies = new Policy[4];
m_offshootPolicies[0] = componentPOA.create_id_assignment_policy(IdAssignmentPolicyValue.SYSTEM_ID);
m_offshootPolicies[1] = componentPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT);
m_offshootPolicies[2] = componentPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY);
m_offshootPolicies[3] = componentPOA.create_servant_retention_policy(ServantRetentionPolicyValue.RETAIN);
}
try {
offshootPoa = componentPOA.create_POA(offshootPoaName, sharedPoaManager, m_offshootPolicies);
m_logger.finest("successfully created offshoot POA");
} catch (InvalidPolicy ex) {
AcsJContainerEx ex2 = new AcsJContainerEx(ex);
ex2.setContextInfo("Attempted to create offshoot POA with invalid policies.");
throw ex2;
} catch (AdapterAlreadyExists ex) {
// we sync on componentPOA, so this should never happen
throw new AcsJUnexpectedExceptionEx(ex);
}
}
}
return offshootPoa;
}
Aggregations