Class DefaultConfig
- All Implemented Interfaces:
Config
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateActor(ActorId actorId) createActorGroup(int actorGroupNumber) Create a actorGroup.createActorId(String actorType) createScheduler(ActorGroup actorGroup) Create a new scheduler.getActorClass(String actorType) Get the class associated with an ActorType which is either a string assigned to the actor by the ActorType annotation or the full class name.intintThe number of actorGroups in a network is more or less fixed.intLocal static Return the current number of threadsgetActorMetadata(String actorType) Static.Return all of the actorClasses that we know ofintThe number of messages inFlight before backpressure is applied.intgetClock()Return the clock used throuhout the system.intgetHost()Return the singleton host for this application instanceReturn a list of host-bound actor typesintEach host in the network has a unique number.The PersisterFactory provides access to persistent services for an Actor.getProperty(String name) Get a Random Number Generator.Get the root directory for this host.The SerializerFactory is instantiated during configurationintvoidlistActors(PrintStream out) Send a list of actorType names and actor class name pairsnow()Return the current instant of the configured clock.voidprintConfig(PrintStream out) Send a list of actorType names and actor class name pairsvoidvalidate(BaseBuilder builder)
-
Constructor Details
-
DefaultConfig
Construct a configuration object. Many of the settings can be specified as functions. This allows some behavior in configuring the system. For example, the message "eviction" setting could change depending on time of day.
In a clustered configuration, some of the configuration settings are shared among all hosts. In these cases, the parameter is described as "dynamic". On the other hand, some configuration settings are unique to a specific host. These settings are described as local. In a single host configuration, there is no difference between local and global settings.
- Parameters:
builder- The builder object used to construct this configuration
-
-
Method Details
-
validate
-
getHostNumber
public int getHostNumber()Each host in the network has a unique number. This number is used to coordinate among multiple hosts in a network. The default is 1. Once assigned, a host number should be permanent. No duplicates.
- Specified by:
getHostNumberin interfaceConfig- Returns:
- An integer containing the host number
-
getActorGroups
public int getActorGroups()The number of actorGroups in a network is more or less fixed. Changing this number is difficult. The number must be consistent on all hosts in the cluster. As such, this setting is maintained by the coordinator.
- Specified by:
getActorGroupsin interfaceConfig- Returns:
- The number of actorGroups
-
getActorGroupReplicas
public int getActorGroupReplicas()- Specified by:
getActorGroupReplicasin interfaceConfig
-
getBackpressureLimit
public int getBackpressureLimit()The number of messages inFlight before backpressure is applied. This limit can change at any time.
- Specified by:
getBackpressureLimitin interfaceConfig- Returns:
-
getEviction
public int getEviction()- Specified by:
getEvictionin interfaceConfig
-
getActorGroupAssigner
- Specified by:
getActorGroupAssignerin interfaceConfig
-
createMessageId
- Specified by:
createMessageIdin interfaceConfig
-
createMessage
- Specified by:
createMessagein interfaceConfig
-
createActorId
- Specified by:
createActorIdin interfaceConfig
-
getActorGroupThreads
public int getActorGroupThreads()Local static Return the current number of threads- Specified by:
getActorGroupThreadsin interfaceConfig- Returns:
-
getCoordinator
- Specified by:
getCoordinatorin interfaceConfig
-
getHost
Return the singleton host for this application instance
-
getClock
Description copied from interface:ConfigReturn the clock used throuhout the system. Usually the default is adequate except for testing.
-
now
Description copied from interface:ConfigReturn the current instant of the configured clock. -
getRandom
Description copied from interface:ConfigGet a Random Number Generator. The default implementation uses ThreadLocalRandom which is bound to the local Thread. Therefore, it is best to only use the result of this call on the stack. Or, at least don't use the returned generator from more than one thread. -
createActorGroup
Create a actorGroup.- Specified by:
createActorGroupin interfaceConfig- Returns:
-
createScheduler
Create a new scheduler. The function is a factory for creating schedulers.
- Specified by:
createSchedulerin interfaceConfig- Returns:
- The new Scheduler subclass
-
getBackpressureWaitMs
public int getBackpressureWaitMs()- Specified by:
getBackpressureWaitMsin interfaceConfig
-
getShutdownWaitMs
public int getShutdownWaitMs()- Specified by:
getShutdownWaitMsin interfaceConfig
-
getProperty
- Specified by:
getPropertyin interfaceConfig
-
getRootDirectory
Description copied from interface:ConfigGet the root directory for this host. Local/Status- Specified by:
getRootDirectoryin interfaceConfig- Returns:
-
getActorClass
Get the class associated with an ActorType which is either a string assigned to the actor by the ActorType annotation or the full class name.- Specified by:
getActorClassin interfaceConfig- Parameters:
actorType- string- Returns:
- Either null or the Actor class, suitable to use to instantiate that actor.
-
getSerializerFactory
Description copied from interface:ConfigThe SerializerFactory is instantiated during configuration- Specified by:
getSerializerFactoryin interfaceConfig- Returns:
-
getPersisterFactory
Description copied from interface:ConfigThe PersisterFactory provides access to persistent services for an Actor. The Factory is instantiated during configuration. The factory implementation can decide during construction how it will handle requests for multiple Actor threads.- Specified by:
getPersisterFactoryin interfaceConfig- Returns:
- PersisterFactory implementation.
-
getActorMetadata
Description copied from interface:ConfigStatic. We need to keep ActorMetadata along with the ActorClass.- Specified by:
getActorMetadatain interfaceConfig
-
getActorTypes
Return all of the actorClasses that we know of- Specified by:
getActorTypesin interfaceConfig- Returns:
-
getHostBoundActorTypes
Description copied from interface:ConfigReturn a list of host-bound actor types- Specified by:
getHostBoundActorTypesin interfaceConfig- Returns:
-
createActor
- Specified by:
createActorin interfaceConfig
-
printConfig
Send a list of actorType names and actor class name pairs- Specified by:
printConfigin interfaceConfig- Parameters:
out-
-
listActors
Send a list of actorType names and actor class name pairs- Specified by:
listActorsin interfaceConfig- Parameters:
out-
-