6 FUTURE WORK
The current prototypical implementation of STATEJ
(www.di.unito.it/˜giannini/stateJimpl/) is based on
the translation scheme outlined in Sect. 4. It con-
sists of a preprocessor that maps code written in JAVA
1.4 extended with state classes into plain JAVA. The
current approach favors simplicity over efficiency. Its
major drawback is that each state transition of an ob-
ject o notifies all the threads waiting for any state of
o. Note that, notifying just the threads waiting for
the target state of the transition would not represent a
significative improvement, since multiple state transi-
tions may occur before the lock on o is released. A
more significative improvement would be moving no-
tification from state transition on o to lock release on
o: this would allow notifying just the threads wait-
ing for the current state of o. Note that, however,
all but the first (according to the scheduling mecha-
nism of JAVA) of such threads have to sleep again. We
are currently investigating a quite different approach
that support selective wakeups. It can be roughly de-
scribed as follows:
• Each object o is equipped with a set of FIFO queues
(one for each state).
• Whenever a thread invokes a method m on o, IF o is
locked by some other thread OR m is not available
in the current state of o
– THEN the thread is suspended and enqueued in
all the queues associated to the states of o
where m is available, and the lock on o (if held
by the suspended thread) is released
– ELSE the method executed and the lock on o (if
not already held by the invoking thread) is taken.
• Whenever the lock on o is released, IF the queue
associated to the current state of o is not empty,
THEN a thread e is extracted from the queue, re-
moved from all the other queues, resumed, and it
takes the lock on o.
Other future work includes: Refinement of the type
and effect system given in (Damiani et al., 2006);
Further investigations on the expressivity of the state
class construct and on its integration in JAVA-like lan-
guages (by analyzing the interaction of state classes
and their types with the advanced features of JAVA-
like languages); Development of a new prototype
(based on the translation scheme outlined above) in-
cluding state attributes and the related type and effect
analysis; and Development of benchmarks.
REFERENCES
Agha, G. A. (1986). ACTORS: A Model of Concurrency
Computation in Distribuited Systems. MIT Press.
Benton, N., Cardelli, L., and Fournet, C. (2004). Mod-
ern Concurrency Abstractions for C♯. ACM TOPLAS,
26(5):769–804.
Birrel, A. D. (1989). An introduction to programming with
threads. Technical Report 35, DEC SRC.
Damiani, F., Dezani-Ciancaglini, M., and Giannini, P.
(2004). On re-classification and multithreading. JOT
(www.jot.fm), 3(11):5–30. Special issue: OOPS track
at SAC 2004.
Damiani, F., Giachino, E., Giannini, P., Cameron, N., and
Drossopoulou, S. (2006). A state abstraction for co-
ordination in java-like languages. In Electronic pro-
ceedings of FTfJP’06 (www.cs.ru.nl/ftfjp/).
Igarashi, A., Pierce, B., and Wadler, P. (2001). Feather-
weight Java: A minimal core calculus for Java and
GJ. ACM TOPLAS, 23(3):396–450.
Itzstein, G. S. and Kearney, D. (2001). Join Java: an alterna-
tive concurrency semantics for Java. Technical Report
ACRC-01-001, Univ. of South Australia.
Kafura, D. G. and Lavender, R. G. (1996). Concur-
rent object-oriented languages and the inheritance
anomaly. In Casavant, T., Tvrdil, P., and Pl
´
asil, F., ed-
itors, Parallel Computers: Theory and Practice, pages
221–264. IEEE Press.
Keen, A. W., Ge, T., Maris, J. T., and Olsson, R. A. (2004).
JR: Flexible distributed programming in an extended
java. TOPLAS, 26(3):578–608.
Milicia, G. and Sassone, V. (2005). Jeeg: Temporal Con-
straints for the Synchronization of Concurrent Ob-
jects. Concurrency Computat.: Pract. Exper., 17(5-
6):539–572.
Nierstrasz, O. (1993). Regular Types for Active Objects. In
OOPSLA’93, volume 28 of ACM SIGPLAN Notices,
pages 1–15.
Parr, T. (2003-2005). StringTem-
plate Documentation. Available at
www.stringtemplate.org./doc/doc.html.
Parr, T. and project group (2005). ANTLR Ref-
erence Manual, Version 2.7.5. Available at
www.antlr.org./doc/index.html.
Philippsen, M. (2000). A Survey of Concurrent Object-
Oriented Languages. Concurrency Computat.: Pract.
Exper., 12(10):917–980.
Ravara, A. and Vasconcelos, V. T. (2000). Typing Non-
uniform Concurrent Objects. In CONCUR’00, volume
1877 of LNCS, pages 474–488, Berlin. Springer.
Tomlinson, C. and Singh, V. (1989). Inheritance and syn-
chronization with enabled-sets. In OOPSLA’89, pages
103–112. ACM.
ICSOFT 2006 - INTERNATIONAL CONFERENCE ON SOFTWARE AND DATA TECHNOLOGIES
12