Class ObjectReservationSingleton
java.lang.Object
com.espertech.esper.runtime.internal.support.ObjectReservationSingleton
Singleton class for testing out multi-threaded code.
Allows reservation and de-reservation of any Object. Reserved objects are added to a HashSet and
removed from the HashSet upon de-reservation.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectReservationSingleton
boolean
Reserve an object, returning true when successfully reserved or false when the object is already reserved.void
Unreserve an object.
-
Method Details
-
getInstance
-
reserve
Reserve an object, returning true when successfully reserved or false when the object is already reserved.- Parameters:
object
- - object to reserve- Returns:
- true if reserved, false to indicate already reserved
-
unreserve
Unreserve an object. Logs a fatal error if the unreserve failed.- Parameters:
object
- - object to unreserve
-