Class BufferedAuthorityFactory

  • All Implemented Interfaces:
    AuthorityFactory, Factory, BufferedFactory, Factory, RegistrableFactory
    Direct Known Subclasses:
    DeferredAuthorityFactory

    public class BufferedAuthorityFactory
    extends AbstractAuthorityFactory
    implements BufferedFactory
    An authority factory that caches all objects created by an other factory. All createFoo(String) methods first looks if a previously created object exists for the given code. If such an object exists, it is returned. Otherwise, the object creation is delegated to the authority factory specified at creation time, and the result is cached in this buffered factory.

    Objects are cached by strong references, up to the amount of objects specified at construction time. If a greater amount of objects are cached, the oldest ones will be retained through a weak reference instead of a strong one. This means that this buffered factory will continue to returns them as long as they are in use somewhere else in the Java virtual machine, but will be discarted (and recreated on the fly if needed) otherwise.

    Since:
    2.1
    Author:
    Martin Desruisseaux (IRD)