Search in sources :

Example 1 with ControlSystemChangeOfStateEvent

use of alma.SPR2005067.ControlSystemChangeOfStateEvent in project ACS by ACS-Community.

the class EventSupplierSpr2005067Impl method sendEvents.

/** Sends some events to an event channel.
    * @param param number of events to send
    */
public void sendEvents(short param) {
    /* 
	* This is OK
	*/
    m_logger.info("Now sending ControlSystemChangeOfStateEvent2 events. This should always be OK");
    try {
        ControlSystemChangeOfStateEvent2 t_block = new ControlSystemChangeOfStateEvent2(alma.SPR2005067.SystemState.INACCESSIBLE, alma.SPR2005067.SystemSubstate.STARTING_UP_PASS1, false, 0);
        for (short i = 0; i < param; i++) {
            m_supplier.publishEvent(t_block);
        }
    } catch (AcsJException e) {
        /*
	    * Here I just log the error trace.
	    * It would be nicer to throw it to the caller,
	    * but the interface of sendEvents does not allow it.
	    * We should change that interface.
	    */
        AcsJGenericErrorEx ex = new AcsJGenericErrorEx("This exception publishing events should have never occurred", e);
        ex.log(m_logger);
    } catch (Throwable thr) {
        AcsJUnexpectedExceptionEx ex = new AcsJUnexpectedExceptionEx("Got unexpected exception", thr);
        /*
	    * Here I just log the error trace.
	    * It would be nicer to throw it to the caller,
	    * but the interface of sendEvents does not allow it.
	    * We should change that interface.
	    */
        ex.log(m_logger);
    }
    /*
	* This fails with JacORB (tested up to version 2.2.4)
	* See SPR 2005067
	*/
    m_logger.info("Now sending ControlSystemChangeOfStateEvent events. This FAILS now but should be OK as well. See SPR2005067");
    try {
        ControlSystemChangeOfStateEvent t_block = new ControlSystemChangeOfStateEvent(alma.SPR2005067.SystemState.INACCESSIBLE, alma.SPR2005067.SystemSubstate.STARTING_UP_PASS1, alma.SPR2005067.SystemState.INACCESSIBLE, alma.SPR2005067.SystemSubstate.STARTING_UP_PASS1, false, 0);
        for (short i = 0; i < param; i++) {
            m_supplier.publishEvent(t_block);
        }
    } catch (AcsJException e) {
        /*
	    * Here I just log the error trace.
	    * It would be nicer to throw it to the caller,
	    * but the interface of sendEvents does not allow it.
	    * We should change that interface.
	    */
        AcsJGenericErrorEx ex = new AcsJGenericErrorEx("This exception is due to SPR2005067", e);
        ex.log(m_logger);
    } catch (Throwable thr) {
        /*
	    * The message int the exception logged is incomplete.
	    * Look at the println and compare to see the difference
	    */
        System.err.println(thr);
        AcsJUnexpectedExceptionEx ex = new AcsJUnexpectedExceptionEx("Got unexpected exception", thr);
        /*
	    * Here I just log the error trace.
	    * It would be nicer to throw it to the caller,
	    * but the interface of sendEvents does not allow it.
	    * We should change that interface.
	    */
        ex.log(m_logger);
    }
}
Also used : AcsJGenericErrorEx(alma.ACSErrTypeCommon.wrappers.AcsJGenericErrorEx) AcsJException(alma.acs.exceptions.AcsJException) ControlSystemChangeOfStateEvent2(alma.SPR2005067.ControlSystemChangeOfStateEvent2) AcsJUnexpectedExceptionEx(alma.ACSErrTypeCommon.wrappers.AcsJUnexpectedExceptionEx) ControlSystemChangeOfStateEvent(alma.SPR2005067.ControlSystemChangeOfStateEvent)

Aggregations

AcsJGenericErrorEx (alma.ACSErrTypeCommon.wrappers.AcsJGenericErrorEx)1 AcsJUnexpectedExceptionEx (alma.ACSErrTypeCommon.wrappers.AcsJUnexpectedExceptionEx)1 ControlSystemChangeOfStateEvent (alma.SPR2005067.ControlSystemChangeOfStateEvent)1 ControlSystemChangeOfStateEvent2 (alma.SPR2005067.ControlSystemChangeOfStateEvent2)1 AcsJException (alma.acs.exceptions.AcsJException)1