Monday, May 9, 2011

Found in the wild: uncertainty

Let met just keep this short and let the code speak for itself:

1 2 3 4 5 6 7 8 
  // The next fields counts the number of time the decide method is called
  //
  // IMPORTANT: This field can be updated by multiple threads. It follows that
  // its values may *not* be incremented sequentially. However, we don't care
  // about the actual value of the field except that from time to time the
  // expression (invocationCounter++ & 0xF) == 0xF) should be true.
  private long invocationCounter = 0;

Three letters apply here.

Posted via email from Iwein's braindumps

No comments: