Basic HTML version of Foils prepared May 19 99

Foil 34 Balking - Example

From Elements of Concurrent Programming in Java Tango Group Internal Technology Seminars -- Spring 99. by Lukasz Beca


1 public class IncrementException extends Exception {}
2
3 public class BalkingBoundedCounter {
4 protected long count_ = BoundedCounter.MIN;
5
6 public synchronized void inc() throws IncrementException {
7 if (count_ >= BoundedCounter.MAX)
8 throw new IncrementException();
9 else
10 ++ count_;
11 }
12 }
13

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed May 19 1999