This class represents a context to define locally scoped environment
settings. This settings are held by
LocalContext.Reference
and typically wrapped within a static method:[code]
LocalContext.enter();
try {
ModuloInteger.setModulus(m); // Performs integer operations modulo m.
Length.showAs(NonSI.INCH); // Shows length in inches.
RelativisticModel.select(); // Uses relativistic physical model.
... // Operations performed using local settings.
} finally {
LocalContext.exit(); // Reverts to previous settings.
}[/code]
Calls to locally scoped methods should be performed either at
start-up (global setting) or within a local context (to avoid
impacting other threads).
As for any context, local context settings are inherited during
ConcurrentContext concurrent executions.
author: Jean-Marie Dautelle version: 3.6, September 24, 2005 See Also: javolution.util.LocalMap |