java.lang.Object
com.hedera.hashgraph.sdk.BaseNetwork<MirrorNetwork,BaseNodeAddress,MirrorNode>
com.hedera.hashgraph.sdk.MirrorNetwork
Utility class.
-
Field Summary
Fields inherited from class com.hedera.hashgraph.sdk.BaseNetwork
closeTimeout, DEFAULT_MAX_NODE_ATTEMPTS, earliestReadmitTime, executor, hasShutDownNow, healthyNodes, maxNodeAttempts, maxNodeBackoff, maxNodeReadmitTime, minNodeBackoff, minNodeReadmitTime, network, nodes, random, transportSecurity -
Method Summary
Modifier and TypeMethodDescriptionprotected MirrorNode(package private) static MirrorNetworkforMainnet(ExecutorService executor) Create a mirror network for mainnet.(package private) static MirrorNetworkforNetwork(ExecutorService executor, List<String> addresses) Create an arbitrary mirror network.(package private) static MirrorNetworkforPreviewnet(ExecutorService executor) Create a mirror network for previewnet.(package private) static MirrorNetworkforTestnet(ExecutorService executor) Create a mirror network for testnet.Extract the network names.(package private) MirrorNodeExtract the next healthy mirror node on the list.(package private) StringThe REST base URL for one mirror node REST call, chosen by round-robin.(package private) StringConvenience to get the REST base URL from the next healthy mirror node.(package private) MirrorNetworksetNetwork(List<String> network) Assign the desired network.Methods inherited from class com.hedera.hashgraph.sdk.BaseNetwork
awaitClose, beginClose, decreaseBackoff, getCloseTimeout, getLedgerId, getMaxNodeAttempts, getMaxNodeBackoff, getMaxNodeReadmitTime, getMinNodeBackoff, getMinNodeReadmitTime, getNodeProxies, getNodesToRemove, getNumberOfMostHealthyNodes, getRandomNode, increaseBackoff, isTransportSecurity, readmitNodes, removeDeadNodes, setCloseTimeout, setLedgerId, setMaxNodeAttempts, setMaxNodeBackoff, setMaxNodeReadmitTime, setMinNodeBackoff, setMinNodeReadmitTime, setNetwork
-
Method Details
-
forNetwork
Create an arbitrary mirror network.- Parameters:
executor- the executor serviceaddresses- the arbitrary address for the network- Returns:
- the new mirror network object
-
forMainnet
Create a mirror network for mainnet.- Parameters:
executor- the executor service- Returns:
- the new mirror network for mainnet
-
forTestnet
Create a mirror network for testnet.- Parameters:
executor- the executor service- Returns:
- the new mirror network for testnet
-
forPreviewnet
Create a mirror network for previewnet.- Parameters:
executor- the executor service- Returns:
- the new mirror network for previewnet
-
getNetwork
Extract the network names.- Returns:
- the network names
-
setNetwork
Assign the desired network.- Parameters:
network- the desired network- Returns:
- the mirror network
- Throws:
TimeoutException- when the transaction times outInterruptedException- when a thread is interrupted while it's waiting, sleeping, or otherwise occupied
-
createNodeFromNetworkEntry
- Specified by:
createNodeFromNetworkEntryin classBaseNetwork<MirrorNetwork,BaseNodeAddress, MirrorNode>
-
getNextMirrorNode
Extract the next healthy mirror node on the list.- Returns:
- the next healthy mirror node on the list
- Throws:
InterruptedException- when a thread is interrupted while it's waiting, sleeping, or otherwise occupied
-
getRestBaseUrl
Convenience to get the REST base URL from the next healthy mirror node.- Throws:
InterruptedException
-
getNextRestBaseUrlRoundRobin
String getNextRestBaseUrlRoundRobin()The REST base URL for one mirror node REST call, chosen by round-robin.Distinct from
getRestBaseUrl(), which picks by health order and is what the consensus-era mirror REST call sites still use. Round-robin is what the HTTP transport proposal specifies: drawing at random from a list nothing ever demotes makes a two-node network with one node down a coin flip that retrying cannot escape, re-flipped on the next call.A transport failure does not mark a mirror node unhealthy. Demotion on failure is the right end state and a different design; it is excluded deliberately rather than forgotten.
- Returns:
- the base URL to pin for the whole call
-