COMP 402: Production Programming← Concurrency →
|Home — Spring 2009|||||Information|||||Resources|||||DrJava|||||SourceForge|||||Blog|
_buffer=new ArrayList ();
ArrayList _buffer=new ArrayList();. That way,
_buffercan only contain elements of type
T. But this is not related to concurrency. In DrJava, however, we don't want to use "raw" types, i.e. classes where you could specify a type. For all Java collections (ArrayList, LinkedList, HashSet, HashMap, etc.), for example, we want to specify the types they contain.
The other solutions were similar. What differed was the use of an
array instead of a list (there are no generic arrays), the use of
notify() instead of
notifyAll(), and item 2
waitingWriters--;are not in the proper place; they may be executed even when the matching
waitingReaders++;are not executed.
There are other ways to implement the homework, but here are our solutions:
Copyright © 2008-2010 Mathias Ricken