Top Description Inners Fields Constructors Methods
org.postgresql.hostchooser

public Class GlobalHostStatusTracker

extends Object
Class Inheritance
Imports
org.postgresql.jdbc.ResourceLock, org.postgresql.util.HostSpec, org.checkerframework.checker.nullness.qual.Nullable, java.util.ArrayList, .HashMap, .List, .Map

Keeps track of HostSpec targets in a global map.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final Map<HostSpec, GlobalHostStatusTracker.HostSpecStatus>
private static final ResourceLock

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv static List<HostSpec>

Returns:

candidate hosts to connect to.
getCandidateHosts
(HostSpec[]
The potential list of hosts.
hostSpecs
,
HostRequirement
The required target server type.
targetServerType
,
long
How stale information is allowed.
hostRecheckMillis
)

Returns a list of candidate hosts that have the required targetServerType.

public static void
reportHostStatus(HostSpec
The host whose status is known.
hostSpec
,
HostStatus
Latest known status for the host.
hostStatus
)

Store the actual observed host status.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hostStatusMapback to summary
private static final Map<HostSpec, GlobalHostStatusTracker.HostSpecStatus> hostStatusMap
lockback to summary
private static final ResourceLock lock

Constructor Detail

GlobalHostStatusTrackerback to summary
public GlobalHostStatusTracker()

Method Detail

getCandidateHostsback to summary
pack-priv static List<HostSpec> getCandidateHosts(HostSpec[] hostSpecs, HostRequirement targetServerType, long hostRecheckMillis)

Returns a list of candidate hosts that have the required targetServerType.

Parameters
hostSpecs:HostSpec[]

The potential list of hosts.

targetServerType:HostRequirement

The required target server type.

hostRecheckMillis:long

How stale information is allowed.

Returns:List<HostSpec>

candidate hosts to connect to.

reportHostStatusback to summary
public static void reportHostStatus(HostSpec hostSpec, HostStatus hostStatus)

Store the actual observed host status.

Parameters
hostSpec:HostSpec

The host whose status is known.

hostStatus:HostStatus

Latest known status for the host.

org.postgresql.hostchooser back to summary

pack-priv Class GlobalHostStatusTracker.HostSpecStatus

extends Object
Class Inheritance
  • java.lang.Object
  • org.postgresql.hostchooser.GlobalHostStatusTracker.HostSpecStatus

Field Summary

Modifier and TypeField and Description
pack-priv final HostSpec
pack-priv long
pack-priv @Nullable HostStatus

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

hostback to summary
pack-priv final HostSpec host
lastUpdatedback to summary
pack-priv long lastUpdated
statusback to summary
pack-priv @Nullable HostStatus status

Constructor Detail

HostSpecStatusback to summary
pack-priv HostSpecStatus(HostSpec host)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override