Class ObjectReservationSingleton

java.lang.Object
com.espertech.esper.runtime.internal.support.ObjectReservationSingleton

public class ObjectReservationSingleton extends Object
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 Details

    • getInstance

      public static ObjectReservationSingleton getInstance()
    • reserve

      public boolean reserve(Object object)
      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

      public void unreserve(Object object)
      Unreserve an object. Logs a fatal error if the unreserve failed.
      Parameters:
      object - - object to unreserve