Package com.illumon.iris.controller
Interface IServerSelectionProvider
- All Known Implementing Classes:
SimpleServerSelectionProvider
public interface IServerSelectionProvider
Interface for persistent query and console server selection implementations. These provide customer-implemented
server-selection algorithms.
Implementations must have a constructor that takes:
- log - a
Logger
that can be used for logging - serverGroupProvider - a
IrisGroupProvider
that can be used to determine allowed servers
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IServerSelectionProvider.ResourcesUnavailableException
Exception to be thrown when resources can't be determined.static class
IServerSelectionProvider.ServerGroup
Information about a server group. -
Method Summary
Modifier and Type Method Description PersistentQueryDbServerConfig
determineServer(String serverGroupName, com.fishlib.auth.UserContext UserContext, int heapSizeMB, String description, boolean isPersistentQuery)
Determine the server (dispatcher) on which to request the worker.void
generateReloadableConfigurationElement(org.jdom2.Element baseElement, com.fishlib.configuration.Configuration config)
Generate anElement
with this server selection provider's configuration.Set<IServerSelectionProvider.ServerGroup>
getServerGroups()
List the available server groups.void
installConfiguration()
Install the verified configuration.void
setServerUsage(PersistentQueryDbServerConfig serverConfig, int usageMB, int workerCount)
Set the current server usage.void
updateServerAvailability(PersistentQueryDbServerConfig serverConfig, boolean available)
Update whether a server is available or not.void
updateServerMaxHeapGB(PersistentQueryDbServerConfig serverConfig, double maxHeapSizeGB)
Update the max per-worker heap size in GB for a server based on the dispatcher's actual configuration.void
updateServerTotalHeapMB(PersistentQueryDbServerConfig serverConfig, int totalHeapMB)
Update the total heap available for a server.void
verifyConfiguration(org.jdom2.Element element, List<PersistentQueryDbServerConfig> serverConfigs)
Given theElement
generated bygenerateReloadableConfigurationElement(org.jdom2.Element, com.fishlib.configuration.Configuration)
, validate and prepare the configuration for use.
-
Method Details
-
getServerGroups
List the available server groups. Each server group will be added to ths list of servers available for query server selection.- Returns:
- the list of available server groups
-
determineServer
@NotNull PersistentQueryDbServerConfig determineServer(@NotNull String serverGroupName, @NotNull com.fishlib.auth.UserContext UserContext, int heapSizeMB, String description, boolean isPersistentQuery) throws IServerSelectionProvider.ResourcesUnavailableExceptionDetermine the server (dispatcher) on which to request the worker.- Parameters:
serverGroupName
- the user-chosen host or server groupUserContext
- the user context when available (internally-generated starts may not have a user context)heapSizeMB
- the requested heap size in MBdescription
- a text description of the requested workerisPersistentQuery
- true if the worker is for a persistent query, false otherwise- Returns:
- a PersistentQueryDbServerConfig that represents the server (dispatcher) on which to request the worker
- Throws:
IServerSelectionProvider.ResourcesUnavailableException
- if a server can't be determined
-
updateServerTotalHeapMB
Update the total heap available for a server. This will be determined by the controller after getting a connection to each dispatcher.- Parameters:
serverConfig
- the server configurationtotalHeapMB
- the total available heap for the dispatcher
-
setServerUsage
void setServerUsage(@NotNull PersistentQueryDbServerConfig serverConfig, int usageMB, int workerCount)Set the current server usage. This may be on an initial dispatcher connection or after a reconnection, or whenever the utilization changes.- Parameters:
serverConfig
- the server configurationusageMB
- the usage in MBworkerCount
- the current number of workers running on that server
-
updateServerAvailability
void updateServerAvailability(@NotNull PersistentQueryDbServerConfig serverConfig, boolean available)Update whether a server is available or not.- Parameters:
serverConfig
- the server configurationavailable
- if true, the server is available; if false, it is not
-
updateServerMaxHeapGB
Update the max per-worker heap size in GB for a server based on the dispatcher's actual configuration.- Parameters:
serverConfig
- the server configurationmaxHeapSizeGB
- the new maximum size
-
generateReloadableConfigurationElement
void generateReloadableConfigurationElement(org.jdom2.Element baseElement, com.fishlib.configuration.Configuration config)Generate anElement
with this server selection provider's configuration. This element will be used to load the configuration indirectly. This element may be generated in a different process than the controller.- Parameters:
baseElement
- theElement
config
- theConfiguration
to be used to generate theElement
-
verifyConfiguration
void verifyConfiguration(@NotNull org.jdom2.Element element, List<PersistentQueryDbServerConfig> serverConfigs) throws ConfigurationVerificationExceptionGiven theElement
generated bygenerateReloadableConfigurationElement(org.jdom2.Element, com.fishlib.configuration.Configuration)
, validate and prepare the configuration for use.- Parameters:
element
- the generatedElement
containing the configurationserverConfigs
- the available dispatchers as determined by the controller- Throws:
ConfigurationVerificationException
- if the provided element can't be used for any reason
-
installConfiguration
void installConfiguration()Install the verified configuration. This will be called afterverifyConfiguration(org.jdom2.Element, java.util.List<com.illumon.iris.controller.PersistentQueryDbServerConfig>)
is successfully called and indicates that the verified configuration should now be used.
-