JADE v6.1

com.dautelle.realtime
Class LocalContext.Variable

java.lang.Object
  extended bycom.dautelle.realtime.LocalContext.Variable
Direct Known Subclasses:
Function.Variable
Enclosing class:
LocalContext

public static class LocalContext.Variable
extends java.lang.Object

This class represents a LocalContext variable. The number of instances of this class is voluntarely limited (see JADE's Configuration for details). Instances of this class should be either static or member of persistent objects.

Accessing a local context variable is fast and does not necessitate internal synchronization or the use of volatile memory. Because a local context is visible only to the thread owner or to concurrent threads which have been synchronized, the Java memory model guarantees that local memory (e.g. cache) has been flushed to main memory and the local context settings are always inherited by inner contexts.


Field Summary
static int MAX
          Holds the maximum number of LocalContext.Variable (system property "jade.variables", default 1024).
 
Constructor Summary
LocalContext.Variable()
          Default constructor (default variable's value is null).
LocalContext.Variable(java.lang.Object defaultValue)
          Creates a context variable having the specified default value.
 
Method Summary
 java.lang.Object getValue()
          Returns the context-local value of this variable.
 void setValue(java.lang.Object value)
          Sets the context-local value of this variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX

public static final int MAX
Holds the maximum number of LocalContext.Variable (system property "jade.variables", default 1024).

Constructor Detail

LocalContext.Variable

public LocalContext.Variable()
Default constructor (default variable's value is null).


LocalContext.Variable

public LocalContext.Variable(java.lang.Object defaultValue)
Creates a context variable having the specified default value.

Parameters:
defaultValue - the default value or root value of this variable.
Method Detail

getValue

public java.lang.Object getValue()
Returns the context-local value of this variable. The first outer LocalContext is searched first, then all outer LocalContext are recursively searched up to the global root context which contains the default values.

Returns:
the context-local value.

setValue

public void setValue(java.lang.Object value)
Sets the context-local value of this variable.

Parameters:
value - the new context-local value or null to inherit the value from outer context (if any).
See Also:
Realtime.toHeap()

JADE v6.1

Copyright © 2004 Jean-Marie Dautelle.