Class ScheduledResourcePropertiesDecorator

All Implemented Interfaces:
org.refcodes.component.Startable, org.refcodes.component.Stoppable, org.refcodes.mixin.AnnotatorAccessor, org.refcodes.mixin.DelimiterAccessor, org.refcodes.mixin.Disposable, org.refcodes.mixin.Dumpable, org.refcodes.mixin.EmptyAccessor, org.refcodes.mixin.TypeAccessor<String>, Properties, ResourceProperties, ScheduledResourceProperties, org.refcodes.struct.CanonicalMap, org.refcodes.struct.Containable, org.refcodes.struct.InterOperableMap<String>, org.refcodes.struct.Keys<String,String>, org.refcodes.struct.PathMap<String>, org.refcodes.struct.Table<String,String>

public class ScheduledResourcePropertiesDecorator extends AbstractResourcePropertiesDecorator<ResourceProperties> implements ScheduledResourceProperties
The ScheduledResourcePropertiesDecorator decorates ResourceProperties from which the properties are to be reloaded periodically via AbstractResourcePropertiesDecorator.reload(ReloadMode). Depending on the invoked constructor, you can define whether orphan removal (see AbstractResourcePropertiesDecorator.reload(ReloadMode)) is to be taken care of and the poll loop time, e.g. in which time interval the properties are to be reloaded.
  • Constructor Details

    • ScheduledResourcePropertiesDecorator

      public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties) throws IOException, ParseException
      Constructs the ScheduledResourcePropertiesDecorator wrapping the given ResourceProperties with default settings being a poll loop time of 10 seconds (as of IoPollLoopTime.NORM and orphan removal (as of AbstractResourcePropertiesDecorator.reload(ReloadMode) being called with true). The scheduling Thread is started as daemon thread (see ThreadMode.DAEMON). Immediately starts polling after construction of this instance for new properties.
      Parameters:
      aProperties - The properties from which the properties are to be reloaded periodically.
      Throws:
      IOException - thrown in case accessing the resource encountered an I/O problem.
      ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      IllegalStateException - in case the attached resource does not support reloading.
    • ScheduledResourcePropertiesDecorator

      public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, int aScheduleTimeMillis) throws IOException, ParseException
      Constructs the ScheduledResourcePropertiesDecorator wrapping the given ResourceProperties with setting the given poll loop time and orphan removal (as of AbstractResourcePropertiesDecorator.reload(ReloadMode) being called with true). The scheduling Thread is started as daemon thread (see ThreadMode.DAEMON). Immediately starts polling after construction of this instance for new properties.
      Parameters:
      aProperties - The properties from which the properties are to be reloaded periodically.
      aScheduleTimeMillis - The time in milliseconds between polling for new properties.
      Throws:
      IOException - thrown in case accessing the resource encountered an I/O problem.
      ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      IllegalStateException - in case the attached resource does not support reloading.
    • ScheduledResourcePropertiesDecorator

      public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, int aScheduleTimeMillis, ReloadMode aReloadMode) throws IOException, ParseException
      Constructs the ScheduledResourcePropertiesDecorator wrapping the given ResourceProperties with setting the given poll loop time and the given orphan removal strategy (as of AbstractResourcePropertiesDecorator.reload(ReloadMode) being called with your argument). The scheduling Thread is started as daemon thread (see ThreadMode.DAEMON). Immediately starts polling after construction of this instance for new properties.
      Parameters:
      aProperties - The properties from which the properties are to be reloaded periodically.
      aScheduleTimeMillis - The time in milliseconds between polling for new properties.
      aReloadMode - when set to ReloadMode.ORPHAN_REMOVAL, then properties existing in the attached resource but not(!) in the Properties itself are(!) removed. Else properties not existing in the attached resource are kept.
      Throws:
      IOException - thrown in case accessing the resource encountered an I/O problem.
      ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      IllegalStateException - in case the attached resource does not support reloading.
    • ScheduledResourcePropertiesDecorator

      public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, int aScheduleTimeMillis, ReloadMode aReloadMode, org.refcodes.controlflow.ThreadMode aThreadMode) throws IOException, ParseException
      Constructs the ScheduledResourcePropertiesDecorator wrapping the given ResourceProperties with setting the given poll loop time and the given orphan removal strategy (as of AbstractResourcePropertiesDecorator.reload(ReloadMode) being called with your argument). Immediately starts polling after construction of this instance for new properties.
      Parameters:
      aProperties - The properties from which the properties are to be reloaded periodically.
      aScheduleTimeMillis - The time in milliseconds between polling for new properties.
      aReloadMode - when set to ReloadMode.ORPHAN_REMOVAL, then properties existing in the attached resource but not(!) in the Properties itself are(!) removed. Else properties not existing in the attached resource are kept.
      aThreadMode - The ThreadMode mode of operation regarding the Thread doing the scheduling job.
      Throws:
      IOException - thrown in case accessing the resource encountered an I/O problem.
      ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      IllegalStateException - in case the attached resource does not support reloading.
    • ScheduledResourcePropertiesDecorator

      public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, int aScheduleTimeMillis, org.refcodes.controlflow.ThreadMode aThreadMode) throws IOException, ParseException
      Constructs the ScheduledResourcePropertiesDecorator wrapping the given ResourceProperties with setting the given poll loop time and orphan removal (as of AbstractResourcePropertiesDecorator.reload(ReloadMode) being called with true). Immediately starts polling after construction of this instance for new properties.
      Parameters:
      aProperties - The properties from which the properties are to be reloaded periodically.
      aScheduleTimeMillis - The time in milliseconds between polling for new properties.
      aThreadMode - The ThreadMode mode of operation regarding the Thread doing the scheduling job.
      Throws:
      IOException - thrown in case accessing the resource encountered an I/O problem.
      ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      IllegalStateException - in case the attached resource does not support reloading.
    • ScheduledResourcePropertiesDecorator

      public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, ReloadMode aReloadMode) throws IOException, ParseException
      Constructs the ScheduledResourcePropertiesDecorator wrapping the given ResourceProperties with setting the the default poll loop time of 10 seconds (as of IoPollLoopTime.NORM and the given orphan removal strategy (as of AbstractResourcePropertiesDecorator.reload(ReloadMode) being called with your argument). The scheduling Thread is started as daemon thread (see ThreadMode.DAEMON). Immediately starts polling after construction of this instance for new properties.
      Parameters:
      aProperties - The properties from which the properties are to be reloaded periodically.
      aReloadMode - when set to ReloadMode.ORPHAN_REMOVAL, then properties existing in the attached resource but not(!) in the Properties itself are(!) removed. Else properties not existing in the attached resource are kept.
      Throws:
      IOException - thrown in case accessing the resource encountered an I/O problem.
      ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      IllegalStateException - in case the attached resource does not support reloading.
    • ScheduledResourcePropertiesDecorator

      public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, ReloadMode aReloadMode, org.refcodes.controlflow.ThreadMode aThreadMode) throws IOException, ParseException
      Constructs the ScheduledResourcePropertiesDecorator wrapping the given ResourceProperties with setting the the default poll loop time of 10 seconds (as of IoPollLoopTime.NORM and the given orphan removal strategy (as of AbstractResourcePropertiesDecorator.reload(ReloadMode) being called with your argument). Immediately starts polling after construction of this instance for new properties.
      Parameters:
      aProperties - The properties from which the properties are to be reloaded periodically.
      aReloadMode - when set to ReloadMode.ORPHAN_REMOVAL, then properties existing in the attached resource but not(!) in the Properties itself are(!) removed. Else properties not existing in the attached resource are kept.
      aThreadMode - The ThreadMode mode of operation regarding the Thread doing the scheduling job.
      Throws:
      IOException - thrown in case accessing the resource encountered an I/O problem.
      ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      IllegalStateException - in case the attached resource does not support reloading.
    • ScheduledResourcePropertiesDecorator

      public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, org.refcodes.controlflow.ThreadMode aThreadMode) throws IOException, ParseException
      Constructs the ScheduledResourcePropertiesDecorator wrapping the given ResourceProperties with default settings being a poll loop time of 10 seconds (as of IoPollLoopTime.NORM and orphan removal (as of AbstractResourcePropertiesDecorator.reload(ReloadMode) being called with true). Immediately starts polling after construction of this instance for new properties.
      Parameters:
      aProperties - The properties from which the properties are to be reloaded periodically.
      aThreadMode - The ThreadMode mode of operation regarding the Thread doing the scheduling job.
      Throws:
      IOException - thrown in case accessing the resource encountered an I/O problem.
      ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      IllegalStateException - in case the attached resource does not support reloading.
  • Method Details

    • dispose

      public void dispose()
      Specified by:
      dispose in interface org.refcodes.mixin.Disposable
    • start

      public void start() throws org.refcodes.component.StartException
      Specified by:
      start in interface org.refcodes.component.Startable
      Throws:
      org.refcodes.component.StartException
    • stop

      public void stop() throws org.refcodes.component.StopException
      Specified by:
      stop in interface org.refcodes.component.Stoppable
      Throws:
      org.refcodes.component.StopException