Package gov.aps.jca.event
Class SynchronizedLimitedInt
- java.lang.Object
-
- gov.aps.jca.event.SynchronizedLimitedInt
-
public class SynchronizedLimitedInt extends Object
Limited sync int var.
-
-
Constructor Summary
Constructors Constructor Description SynchronizedLimitedInt(int initialValue, int limit)Make a new SynchronizedLimitedInt with the given initial value, and using its own internal lock.SynchronizedLimitedInt(int initialValue, int limit, Object lock)Make a new SynchronizedLimitedInt with the given initial value, and using the supplied lock.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdecrement()Decrement the value.voiddestroy()Destroy this instance - wakeup and disable all sync waits.intget()Return the current valueintincrement()Increment the value.intincrement(boolean doNotBlock)Increment the value.StringtoString()
-
-
-
Field Detail
-
value_
protected int value_
-
limit_
protected int limit_
-
lock_
protected final Object lock_
-
destroyed
protected boolean destroyed
-
-
Constructor Detail
-
SynchronizedLimitedInt
public SynchronizedLimitedInt(int initialValue, int limit)Make a new SynchronizedLimitedInt with the given initial value, and using its own internal lock.
-
SynchronizedLimitedInt
public SynchronizedLimitedInt(int initialValue, int limit, Object lock)Make a new SynchronizedLimitedInt with the given initial value, and using the supplied lock.
-
-
Method Detail
-
get
public final int get()
Return the current value
-
increment
public int increment()
Increment the value.- Returns:
- the new value
-
increment
public int increment(boolean doNotBlock)
Increment the value.- Returns:
- the new value
-
decrement
public int decrement()
Decrement the value.- Returns:
- the new value
-
destroy
public void destroy()
Destroy this instance - wakeup and disable all sync waits.
-
-