org.curjent.impl.agent
Class Count

java.lang.Object
  extended by org.curjent.impl.agent.Count

final class Count
extends Object

Sharable holder for the Mark count value. When a marker is canceled, the next marker inherits the remaining count value of the canceled marker, and the canceled mark's messages now belong to the next mark. For example, assume 4 calls are queued named A, B, C and D. A is the first in the queue and D the last. B and D are markers. Each marker has a count value of 2. B's count includes A and B, and D's count includes C and D. B should not execute until A is finished, and D should not execute until A, B and C are finished. If B is canceled, that leaves A, C and D, but A still references B's marker, and D's marker now has an incorrect count value of 2. D's marker count should be 3, one each for A, C and D. This is fixed up by adding B's marker count value (now 1 since B finished, leaving only A) to D's marker count value (1 + 2 = 3). B's marker count reference is then set to D's marker count object. So, although A still references B's marker, updates to B's marker count value are now accurately reflected in D's marker since both markers share the same count object.

Marks and shared counts are synchronized with the controller's central lock, not with invididual message monitors.


Field Summary
(package private)  int value
          Marker count value.
 
Constructor Summary
Count()
           
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

int value
Marker count value.

Constructor Detail

Count

Count()


Copyright 2009-2011 Tom Landon
Apache License 2.0