Search in sources :

Example 1 with AcsJCouldntPerformActionEx

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);
    }
}
Also used : AcsJCouldntPerformActionEx(alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx) AcsJException(alma.acs.exceptions.AcsJException) CompletionHolder(alma.ACSErr.CompletionHolder)

Example 2 with AcsJCouldntPerformActionEx

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;
}
Also used : COUNTER.statusBlockEvent(alma.COUNTER.statusBlockEvent) AcsJCouldntPerformActionEx(alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx) ComponentLifecycleException(alma.acs.component.ComponentLifecycleException)

Example 3 with AcsJCouldntPerformActionEx

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;
}
Also used : AcsJCouldntPerformActionEx(alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx) ComponentLifecycleException(alma.acs.component.ComponentLifecycleException)

Example 4 with AcsJCouldntPerformActionEx

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;
    }
}
Also used : DummyComponent(alma.jconttest.DummyComponent) JconttestUtil(alma.jconttest.util.JconttestUtil) AcsJCouldntPerformActionEx(alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx)

Example 5 with AcsJCouldntPerformActionEx

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();
    }
}
Also used : AcsJCouldntPerformActionEx(alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx)

Aggregations

AcsJCouldntPerformActionEx (alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx)15 AcsJException (alma.acs.exceptions.AcsJException)3 CompletionHolder (alma.ACSErr.CompletionHolder)2 COUNTER.statusBlockEvent (alma.COUNTER.statusBlockEvent)2 ComponentLifecycleException (alma.acs.component.ComponentLifecycleException)2 AcsLogLevel (alma.acs.logging.AcsLogLevel)2 StopWatch (alma.acs.util.StopWatch)2 NcEventSpec (alma.benchmark.NcEventSpec)2 CouldntPerformActionEx (alma.ACSErrTypeCommon.CouldntPerformActionEx)1 OutOfBoundsAcsJCompletion (alma.ACSErrTypeCommon.wrappers.OutOfBoundsAcsJCompletion)1 NestedFridgeEvent (alma.FRIDGE.FridgeControlPackage.NestedFridgeEvent)1 ComponentQueryDescriptor (alma.acs.component.ComponentQueryDescriptor)1 AcsLoggingHandler (alma.acs.logging.AcsLoggingHandler)1 StdOutConsoleHandler (alma.acs.logging.StdOutConsoleHandler)1 AcsLogLevelDefinition (alma.acs.logging.level.AcsLogLevelDefinition)1 DummyComponent (alma.jconttest.DummyComponent)1 JconttestUtil (alma.jconttest.util.JconttestUtil)1 LoggingConfig (alma.maci.loggingconfig.LoggingConfig)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1