Class FactoryBase.LifeCycleConfig<L,​R extends FactoryBase<?,​R>>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setCreator​(java.util.function.Supplier<L> creator)
      create and prepare the liveObject
      void setDestroyer​(java.util.function.Consumer<L> destroyerWithPreviousLiveObject)
      finally free liveObject e.g close a port
      void setReCreator​(java.util.function.Function<L,​L> reCreatorWithPreviousLiveObject)
      the factory data has changed therefore a new liveobject is needed.
      previousLiveObject can be used to pass runtime status from previous object (e.g request counter).
      passed previous liveobject is never null
      void setStarter​(java.util.function.Consumer<L> starterWithNewLiveObject)
      start the liveObject e.g open a port
      void setUpdater​(java.util.function.Consumer<L> updater)
      the factory data has changed therefore bud you want to reuse the liveObject and only update it.
      (that means that parents do not have to be recreated.)
      • Methods inherited from class java.lang.Object

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

      • LifeCycleConfig

        public LifeCycleConfig​(FactoryBase<L,​R> factory)
    • Method Detail

      • setCreator

        public void setCreator​(java.util.function.Supplier<L> creator)
        create and prepare the liveObject
        Parameters:
        creator - creator
      • setReCreator

        public void setReCreator​(java.util.function.Function<L,​L> reCreatorWithPreviousLiveObject)
        the factory data has changed therefore a new liveobject is needed.
        previousLiveObject can be used to pass runtime status from previous object (e.g request counter).
        passed previous liveobject is never null
        Parameters:
        reCreatorWithPreviousLiveObject - reCreatorWithPreviousLiveObject
      • setUpdater

        public void setUpdater​(java.util.function.Consumer<L> updater)
        the factory data has changed therefore bud you want to reuse the liveObject and only update it.
        (that means that parents do not have to be recreated.)
        Parameters:
        updater - updater
      • setStarter

        public void setStarter​(java.util.function.Consumer<L> starterWithNewLiveObject)
        start the liveObject e.g open a port
        Parameters:
        starterWithNewLiveObject - starterWithNewLiveObject
      • setDestroyer

        public void setDestroyer​(java.util.function.Consumer<L> destroyerWithPreviousLiveObject)
        finally free liveObject e.g close a port
        Parameters:
        destroyerWithPreviousLiveObject - destroyerWithPreviousLiveObject