Class AbstractPrototypeProvisionStrategy

  • All Implemented Interfaces:
    java.io.Serializable, java.util.concurrent.locks.ReadWriteLock
    Direct Known Subclasses:
    AbstractCompositeComponentPrototypeProvisionStrategy

    public abstract class AbstractPrototypeProvisionStrategy
    extends java.util.concurrent.locks.ReentrantReadWriteLock
    Abstract strategy for keeping track of prototype providers and working with provisioned prototypes. When the prototype providers change provided prototypes, those provided prototypes are processed. Prototype provisions are not processed initially; this strategy should be initialized after construction by calling processPrototypeProvisions(). This class is thread safe based upon its exposed read and write locks.
    Author:
    Garret Wilson
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.concurrent.locks.ReentrantReadWriteLock

        java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock, java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean addPrototypeProvider​(PrototypeProvider prototypeProvider)
      Add a prototoype provider to be managed.
      protected java.util.Set<PrototypeProvision<?>> gatherPrototypeProvisions()
      Gather prototype provisions from the known prototype providers.
      protected java.lang.Iterable<PrototypeProvider> getPrototypeProviders()
      Returns an iterable to the prototype providers known to this provision strategy.
      void processPrototypeProvisions()
      Processes prototype provisions.
      protected abstract void processPrototypeProvisions​(java.util.Set<PrototypeProvision<?>> prototypeProvisions)
      Processes prototype provisions.
      protected boolean removePrototypeProvider​(PrototypeProvider prototypeProvider)
      Removes a prototoype provider being managed.
      • Methods inherited from class java.util.concurrent.locks.ReentrantReadWriteLock

        getOwner, getQueuedReaderThreads, getQueuedThreads, getQueuedWriterThreads, getQueueLength, getReadHoldCount, getReadLockCount, getWaitingThreads, getWaitQueueLength, getWriteHoldCount, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isWriteLocked, isWriteLockedByCurrentThread, readLock, toString, writeLock
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AbstractPrototypeProvisionStrategy

        public AbstractPrototypeProvisionStrategy​(PrototypeProvider... prototypeProviders)
        Prototype providers constructor.
        Parameters:
        prototypeProviders - The prototype providers that will provide prototypes for processing.
        Throws:
        java.lang.NullPointerException - if the given prototype providers and/or one or more prototype provider is null.
    • Method Detail

      • getPrototypeProviders

        protected java.lang.Iterable<PrototypeProvider> getPrototypeProviders()
        Returns an iterable to the prototype providers known to this provision strategy. This iterable should be accessed under a read lock.
        Returns:
        The prototype providers known to this provision strategy.
      • addPrototypeProvider

        protected boolean addPrototypeProvider​(PrototypeProvider prototypeProvider)
        Add a prototoype provider to be managed. If the prototype provider is already being managed, no action occurs.
        Parameters:
        prototypeProvider - The prototype provider to add.
        Returns:
        true if the prototype provider was not already being managed.
      • removePrototypeProvider

        protected boolean removePrototypeProvider​(PrototypeProvider prototypeProvider)
        Removes a prototoype provider being managed. If the prototype provider is not being managed, no action occurs.
        Parameters:
        prototypeProvider - The prototype provider to remove.
        Returns:
        true if the prototype provider was not already being managed.
      • gatherPrototypeProvisions

        protected java.util.Set<PrototypeProvision<?>> gatherPrototypeProvisions()
        Gather prototype provisions from the known prototype providers. The returned set is mutable.
        Returns:
        The prototype provisions gathered for later processing from the known prototype providers.
      • processPrototypeProvisions

        protected abstract void processPrototypeProvisions​(java.util.Set<PrototypeProvision<?>> prototypeProvisions)
        Processes prototype provisions.
        Parameters:
        prototypeProvisions - The mutable set of prototype provisions to be used.