Class 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 IScenarioDefinition#createInstance(String)
    • @see IScenarioInstance#setValue(String, Object)
    • @see IScenarioInstance#setValues(java.util.Map)
    • @see IScenarioInstance#delete()
    See Also:
    Serialized Form
    • Method Summary

      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, 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)