Package com.arpnetworking.utility
Class ActorConfigurator<T>
java.lang.Object
com.arpnetworking.utility.ActorConfigurator<T>
- Type Parameters:
T
- The type representing the validated configuration.
- All Implemented Interfaces:
Listener
A launchable intended to be used from a Configurator to notify an actor about new configuration.
- Author:
- Brandon Arp (brandon dot arp at inscopemetrics dot com)
-
Constructor Summary
ConstructorDescriptionActorConfigurator
(akka.actor.ActorRef notifyTarget, Class<? extends T> configurationClass) Public constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked to apply the most recently offered configuration.void
offerConfiguration
(Configuration configuration) Invoked before new configuration is applied.
-
Constructor Details
-
ActorConfigurator
Public constructor.- Parameters:
notifyTarget
- actor to notify of configuration updateconfigurationClass
- the class of the configuration
-
-
Method Details
-
offerConfiguration
Description copied from interface:Listener
Invoked before new configuration is applied. Any registered listener may reject the configuration by throwing anException
. Any listener rejecting the configuration rejects the entire configuration and the offering instance will log theException
with an error. Once any listener rejects theConfiguration
other listeners may not be offered that instance.- Specified by:
offerConfiguration
in interfaceListener
- Parameters:
configuration
- The newConfiguration
to be validated.- Throws:
Exception
- Thrown if theConfiguration
should be rejected.
-
applyConfiguration
public void applyConfiguration()Description copied from interface:Listener
Invoked to apply the most recently offered configuration. AnyRuntimeException
thrown is logged and ignored. All validation must be performed during offer.- Specified by:
applyConfiguration
in interfaceListener
-