use of alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx in project ACS by ACS-Community.
the class CommonPropertyImpl method setSync.
/*********************** [ RW<type> helpers ] ***********************/
/**
* @see alma.ACSErr.Completion alma.ACS.RW<type>Operations#set_sync(<type>)
*/
protected Completion setSync(Object value) throws AcsJException {
try {
CompletionHolder completionHolder = CompletionUtil.createCompletionHolder();
dataAccess.set(value, completionHolder);
// generate no-error completion, if not generated
if (completionHolder.value == null)
completionHolder.value = CompletionUtil.generateNoErrorCompletion();
return completionHolder.value;
} catch (AcsJException acsex) {
throw new AcsJCouldntPerformActionEx("Failed to set value.", acsex);
}
}
use of alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx in project ACS by ACS-Community.
the class CounterConsumerImpl method getBlocks.
/////////////////////////////////////////////////////////////
// Implementation of CounterConsumerOperations
/////////////////////////////////////////////////////////////
/**
* @throws CouldntPerformActionEx
* @see alma.COUNTER.CounterConsumerOperations#getBlocks()
*/
@Override
public void getBlocks() throws CouldntPerformActionEx {
try {
subscriber = m_containerServices.createNotificationChannelSubscriber(alma.COUNTER.CHANNELNAME_COUNTER.value, statusBlockEvent.class);
//Subscribe to an event type.
subscriber.addSubscription(this);
//After consumerReady() is invoked, receive(...) is invoked
//by the notification channel. That is, we have no control over when
//that method is called.
subscriber.startReceivingEvents();
m_logger.info("CounterConsumer is ready to receive 'status' events.");
} catch (Exception ex) {
if (subscriber != null) {
try {
subscriber.disconnect();
} catch (Exception ex3) {
// too bad, but we forward rather the original ex
}
}
AcsJCouldntPerformActionEx ex2 = new AcsJCouldntPerformActionEx();
ex2.setProperty(PROP_ASSERTION_MESSAGE, "failed to connect as an event consumer to channel " + alma.COUNTER.CHANNELNAME_COUNTER.value);
throw ex2.toCouldntPerformActionEx();
}
return;
}
use of alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx in project ACS by ACS-Community.
the class CounterConsumerImpl method waitTillDone.
/**
* @throws CouldntPerformActionEx
* @see alma.COUNTER.CounterConsumerOperations#waitTillDone()
*/
@Override
public int waitTillDone() throws CouldntPerformActionEx {
if (subscriber == null) {
AcsJCouldntPerformActionEx ex = new AcsJCouldntPerformActionEx();
ex.setProperty(PROP_ASSERTION_MESSAGE, "Consumer didn't even start yet");
throw ex.toCouldntPerformActionEx();
}
while (contFlag) {
try {
m_logger.info("CounterConsumer received " + eventCount + " blocks so far ... will sleep 1000 ms more.");
Thread.sleep(1000);
} catch (Exception e) {
}
}
return eventCount;
}
use of alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx in project ACS by ACS-Community.
the class DummyComponentWrapperImpl method _callDummyComponentWithTime.
public boolean _callDummyComponentWithTime(int timeInMillisec, String targetComponentName) throws AcsJCouldntPerformActionEx {
DummyComponent dummyComponent = null;
try {
org.omg.CORBA.Object compObj = null;
if (targetComponentName != null) {
compObj = m_containerServices.getComponent(targetComponentName);
} else {
compObj = m_containerServices.getDefaultComponent(DUMMYCOMP_TYPENAME);
}
dummyComponent = DummyComponentHelper.narrow(compObj);
} catch (Exception e) {
m_logger.log(Level.SEVERE, "Failed to access target component.", e);
throw new AcsJCouldntPerformActionEx();
}
targetComponentName = dummyComponent.name();
// If the given time is less than 0, then we call "callThatTakesSomeTime" with a time larger than the ORB-level timeout.
if (timeInMillisec < 0) {
JconttestUtil util = new JconttestUtil(m_containerServices);
int orbLevelTimeoutMillis = util.getSystemLevelOrbTimeoutMillis();
timeInMillisec = orbLevelTimeoutMillis + 1000;
}
try {
dummyComponent.callThatTakesSomeTime(timeInMillisec);
m_logger.info("Did NOT get org.omg.CORBA.TIMEOUT in call " + targetComponentName + "#callThatTakesSomeTime(" + timeInMillisec + ")");
return false;
} catch (org.omg.CORBA.TIMEOUT e) {
m_logger.info("Got org.omg.CORBA.TIMEOUT in call " + targetComponentName + "#callThatTakesSomeTime(" + timeInMillisec + ")");
return true;
}
}
use of alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx in project ACS by ACS-Community.
the class CorbaNotifyBaseImpl method ncDisconnect.
@Override
public void ncDisconnect() throws CouldntPerformActionEx {
interrupt();
Exception lastEx = null;
for (T subOrPub : subsOrPubs.values()) {
try {
disconnectNcParticipant(subOrPub);
} catch (Exception ex) {
lastEx = ex;
}
}
if (lastEx != null) {
throw new AcsJCouldntPerformActionEx(lastEx).toCouldntPerformActionEx();
}
}
Aggregations