com.apama.services.scenario
Class IllegalCallingThreadException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by java.lang.IllegalStateException
                  extended by com.apama.services.scenario.IllegalCallingThreadException
All Implemented Interfaces:
java.io.Serializable

public class IllegalCallingThreadException
extends java.lang.IllegalStateException

Thrown when an attempt is made to change the state of running scenarios in the data queue processing thread.

The Scenario Service guarantees that updates from scenarios are processed in order. The service also guarantees that any operation to change the state of running scenarios does not complete until any previous updates have been processed. It does not provide any guarantees of atomicity of operations.

This means that if an operation to change a scenario's state is attempted while in a PropertyChangeListener, the operation should not complete until after the PropertyChangeListener has completed. As this is not possible, the attempted operation will throw this exception instead.

If a scenario requires a change to an input variable because of an output variable, the scenario should do this by using rules in the scenario itself. Any such changes will then happen atomically - this cannot be done atomically using the Scenario Service (and any such input variables should be marked as output variables as well).

Alternatively, another thread should be used to perform the operation - this allows the PropertyChangeListener to complete before the operation. Note that further PropertyChangeListener calls may occur before the operation is complete.
A simple implementation may be:

                new Thread(new Runnable() {
                        public void run() {
                                instance.setValues(values);
                        }
                }).start();
 

Note that this will not complete until after the caller has returned, and further calls to PropertyChangeListeners may occur (and need to complete) before the setValues method returns.

Operations that throw this exception:

See Also:
Serialized Form

Constructor Summary
IllegalCallingThreadException(java.lang.String operation)
          See class description.
 
Method Summary
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IllegalCallingThreadException

public IllegalCallingThreadException(java.lang.String operation)
See class description.



Submit a bug or feature
Copyright (c) 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors. Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG