Package org.postgresql.hostchooser
Class GlobalHostStatusTracker
java.lang.Object
org.postgresql.hostchooser.GlobalHostStatusTracker
Keeps track of HostSpec targets in a global map.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Map
<HostSpec, GlobalHostStatusTracker.HostSpecStatus> private static final ResourceLock
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCandidateHosts
(HostSpec[] hostSpecs, HostRequirement targetServerType, long hostRecheckMillis) Returns a list of candidate hosts that have the required targetServerType.static void
reportHostStatus
(HostSpec hostSpec, HostStatus hostStatus) Store the actual observed host status.
-
Field Details
-
hostStatusMap
-
lock
-
-
Constructor Details
-
GlobalHostStatusTracker
public GlobalHostStatusTracker()
-
-
Method Details
-
reportHostStatus
Store the actual observed host status.- Parameters:
hostSpec
- The host whose status is known.hostStatus
- Latest known status for the host.
-
getCandidateHosts
static List<HostSpec> getCandidateHosts(HostSpec[] hostSpecs, HostRequirement targetServerType, long hostRecheckMillis) Returns a list of candidate hosts that have the required targetServerType.- Parameters:
hostSpecs
- The potential list of hosts.targetServerType
- The required target server type.hostRecheckMillis
- How stale information is allowed.- Returns:
- candidate hosts to connect to.
-