Class SingletonLazyRef<T>

java.lang.Object
org.aksw.commons.util.ref.SingletonLazyRef<T>
All Implemented Interfaces:
Serializable, Supplier<Ref<T>>

public class SingletonLazyRef<T> extends Object implements Supplier<Ref<T>>, Serializable
A wrapper that turns a supplier of references into a singleton such that at any given time (on a specific jvm) only a most a single reference will have been acquired from that supplier. The intended use case is to allow for sharing a supplier of a DataSource across a cluster. Each involved jvm may obtain its own singleton instnance from that supplier such that there is only one connection pool per jvm from where connections can be drawn.
See Also:
  • Field Details

    • instanceId

      protected String instanceId
    • refSupplier

      protected Supplier<? extends Ref<T>> refSupplier
  • Constructor Details

    • SingletonLazyRef

      public SingletonLazyRef(String instanceId, Supplier<? extends Ref<T>> refSupplier)
  • Method Details