|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A common interface for all lockable parts of ACS. The locking mechanism makes it possible to safely split all data structures that are used inside a web server into ones that are constant across all requests and those that may change during a request.
The distinction betwen static and request-specific data helps in
optimizing the amount of memory that needs to be allocated for each
request. Data structures that are static can be allocated and
initialized ahead of time, e.g., in the init
method of a
servlet. The initialized data structures are then locked to
make them immutable. This mechanism ensures that static structures that
are supposed to be shared by many requests, often even concurrently, do
not change and are not "polluted" by request-specific data.
There is no automatic mechanism that makes an object immutable by
itself. The right checks and operations need to be implemented by each
class implementing Lockable
.
Bebop parameters are a good example of how one logical structure is
split into two classes: the class ParameterModel
is Lockable
and only contains the description of the parameter in an HTTP request
that is static and does not change on a per-request basis, such as the
name of the parameter and the (Java) type that the parameter value
should be converted to. The class ParameterData
contains all the
request-specific information for a parameter, such as the value of the
parameter.
Any class that implements Lockable
is expected to be
fully modifiable until its lock()
method is called. From that
point on, it is read-only and should throw exceptions whenever an
attempt is made to modify it.
Field Summary | |
static String |
versionId
|
Method Summary | |
boolean |
isLocked()
Return whether an object is locked and thus immutable, or can still be modified. |
void |
lock()
Lock an object. |
Field Detail |
public static final String versionId
Method Detail |
public void lock()
setXXX
method
should lead to an exception.
Most lockable Bebop classes throw an IllegalStateException
if an attempt is made to modify a
locked instance.
public boolean isLocked()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |