.setLocale ( String language , String country )
Set the locale for the connection.
Typically called immediately by the client if the server's
default locale is not satisfactory.
.close ( )
Close the connection gracefully.
.createPrivate ( String name )
Create a private interpreter with the given name.
The interpreter will persist until either explicitly
destroyed or the connection terminates.
.setPrivate ( String name )
Set the named private interpreter as the connection's
current interpreter. The interpreter will persist until
either explicitly destroyed or the connection terminates.
.destroyPrivate ( String name )
Remove the named private interpreter from the
list of private interpreters. If the interpreter
is the connection's current interpreter, the connection
can continue to use the interpreter with no problem.
Once the connection loses a reference to the interpreter,
or the connection terminates, the interpreter is eligible
for garbage collection. All private interpreters created by a
connection become eligible for garbage collection when the
connection terminates.
.createShared ( String name )
Create a shared interpreter with the given name.
A shared interpreter persists until destroyed.
WARNING: any methods or variables in a shared
interpreter's namespace are subject to multi-threaded
access.
.setShared ( String name )
Set the named shared interpreter as the
connection's current interpreter.
WARNING: any methods or variables in a shared
interpreter's namespace are subject to multi-threaded
access.
.destroyShared ( String name )
Remove the named shared interpreter from the list
of shared interpreters. This effectively makes the
named interpreter unreachable by any connection
that is not already using the interpreter. Any
connections currently using the removed interpreter
can continue to use it with no problem. Once the last
connection loses a reference to the interpreter, it
becomes eligible for garbage collection.
Any connection can destroy an interpreter.
.push ( )
Push the current namespace of the connection's current
interpreter onto the namespace stack, and create and set
a new child namespace for the interpreter. The name of the
new namespace is "n" + stack.size(). The new namespace
will have visibility on all variables and methods
that the parent namespace had. Any typed variable
declarations will "shadow" a variable with the same
name in the parent's scope. Any typed or new variable
declarations will become invisible when the child
namespace is popped, but any assignment of value to
to a variable in the parent's scope will remain.
Although this operation is not prohibited on shared
interpreters, it would probably be very confusing to
the sharers.
.pop ( )
Pop the last-in namespace from the namespace stack
of connection's current interpreter and set it on
the interpreter.
.setTimeout ( long timeout )
Set the connection's timeout, in milleseconds.
The timeout value is used to start a timer for
any thread wait() block. When the timer expires,
the thread is interrupted if it is still blocked.
Any shared interpreter will block at lock(), unlock(),
and eval() if the interpreter is locked by another
thread (connection). If a thread unblocks before the
timer expires, the interrupt is cancelled.
.lock ( String name )
Lock the named shared interpreter using the
connection's current timeout value.
.lock ( String name , long timeout )
Lock the named interpreter. If the lock is unavailable
for more than the given timeout value, interrupt
the thread. Although a private interpreter can be
locked, there is no advantage, because it is only
visible to one connection thread.
.unlock ( String name )
Unlock the named shared interpreter using the
connection's current timeout value.
.unlock ( String name , long timeout )
Unlock the named shared interpreter. To unlock the interpreter
the method will try to get the lock. If the lock is
unavailable for more than the given timeout value,
the thread is interrupted. Although a private interpreter
can be locked and unlocked, there is no advantage,
because it is only visible to one connection thread.
.getLastThrowable ( )
Get the last throwable encountered by the connection when
it was evaluating source code.