Java Reference
In-Depth Information
Examples
The following code shows the implementation of three
classes. Class
Service
represents a service component that
offers static method
execute()
. Class
Father
and
Child
make
a simple inclusion hierarchy.
public class
Counter {
private static int
value
#
0;
public static void
increment() { value
!!
; }
}
public class
Child {
public void
doService() {
Counter.increment();
. . .
}
}
public class
Father {
private
Child child;
public void
doService() {
child.doService();
. . .
Counter.increment();
}
}
Force resolution
Static methods behave like global functions. They are
accessible from every level of an application's inclusion
hierarchy. Information hiding is enforced since they
modify data confined in a single class.
Design rationale
The relationship between the service component and the
components that use it is implemented as the relation
between a class definition and a set of objects.
18.8
■
References
Alvisi, L. and Marzullo K. (1998) “Message Logging: Pessimistic, Optimistic, Causal,
and Optimal”,
IEEE Transactions on Software Engineering
, Vol. 24, No. 2,
February, 149
-
159.
Hulse, D. and Dearle A. (1998) “Lumberjack: A Log-structured Persistent Store”, in
Proc. of Eighth Int. Workshop on Persistent Object Systems (POS-8)
, Tiburon,
California, 187
-
198.