public final class Context
extends java.lang.Object
implements java.lang.Cloneable
The Context class provides a Java representation of the MonitorScript context type.
It defines a handle to a correlator context. This class must only be used from JMon (and not from an EPL plugin)
Returns a string representation of the context instance.
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
Constructor Detail
Context
public Context()
The default constructor. This constructor will create a "dummy" context, which does not
correspond to a real correlator context. It provides the same functionality
as uninitialized context variables in MonitorScript.
This cannot be used to send events to.
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException
See Also:
Object.clone()
getId
public long getId()
Returns a unique identifier for the context.
For a Context instance that would return the following toString() result:
\"context(2,\"context_name\",false)\", getId() would return the value 2.
This method returns 0 for a Context instance created with the default constructor.
For more information, see the MonitorScript documentation about context datatypes.
getName
public java.lang.String getName()
Returns the name of the context.
For the context that is created with the following MonitorScript code:
context c := context(\"test\");
When getName() method is called after this instance is retrieved in JMon,
it would return \"test\".
This method returns an empty string for a Context instance created with the
default constructor.
For more information, see the MonitorScript documentation about context datatypes.
toString
public java.lang.String toString()
Returns a string representation of the context instance.
This method produces an identical string to the one produced in MonitorScript.
Example output: \"context(2,\"context_name\",false)\".
In this example, the first item in the string (2) refers to the correlator context unique identifier.
The second item in the string (\"context_name\") is the name of the context.
The third item in the string refers to the value of receivesInput boolean flag,
indicating whether the context is public or private.
This method returns \"context(0,\"\",false)\" for a Context instance created with the
default constructor.
For more information on the definition of public and private contexts, please see the
MonitorScript documentation
(Writing MonitorScript Applications | Implementing Parallel Processing | Creating Contexts)
Returns a Context instance that corresponds to the current correlator context.
Single-threaded JMon applications are executed in the main correlator context
and as a result, this method will return an instance that corresponds
to this correlator context. JMon applications can create new Java threads during their
execution and these are not to be confused with correlator contexts.
This method will return null when called inside newly created Java threads.
hashCode
public int hashCode()
Overrides:
hashCode in class java.lang.Object
isPublic
public boolean isPublic()
Returns true if the context is public (receives external / enqueued events)
Submit a bug or feature Copyright (c) 2013-2021 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.