com.apama.jmon
Class Context
java.lang.Object
com.apama.jmon.Context
- All Implemented Interfaces:
- java.lang.Cloneable
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)
Method Summary |
java.lang.Object |
clone()
|
boolean |
equals(java.lang.Object other)
|
static Context |
getCurrent()
Returns a Context instance that corresponds to the current correlator context. |
long |
getId()
Returns a unique identifier for the context. |
java.lang.String |
getName()
Returns the name of the context. |
int |
hashCode()
|
boolean |
isPublic()
Returns true if the context is public (receives external / enqueued events) |
java.lang.String |
toString()
Returns a string representation of the context instance. |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
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.
Context
public Context(Context c)
- A copy constructor
clone
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)
- Overrides:
toString
in class java.lang.Object
getCurrent
public static Context getCurrent()
- 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)
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in class java.lang.Object
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