Interface NodeDiscovery
- All Known Implementing Classes:
GridEngineNodeDiscovery,K8sNodeDiscovery,SlurmNodeDiscovery
public interface NodeDiscovery
Interface for node discovery in distributed actor systems.
Implementations of this interface provide environment-specific logic to discover nodes in distributed computing environments such as Slurm, Kubernetes, or Grid Engine.
Usage Example
// Auto-detect environment and discover nodes
NodeDiscovery discovery = NodeDiscoveryFactory.autoDetect();
// Get current node information
String myNodeId = discovery.getMyNodeId();
String myHost = discovery.getMyHost();
int myPort = 8080;
// Create distributed actor system
DistributedActorSystem system =
new DistributedActorSystem(myNodeId, myHost, myPort);
// Register all remote nodes
for (NodeInfo node : discovery.getAllNodes()) {
if (!node.getNodeId().equals(myNodeId)) {
system.registerRemoteNode(
node.getNodeId(),
node.getHost(),
node.getPort()
);
}
}
- Since:
- 2.5.0
- Author:
- devteam@scivics-lab.com
-
Method Summary
Modifier and TypeMethodDescriptionReturns information about all nodes in the cluster.Returns the hostname or IP address for the current node.Returns the unique identifier for the current node.default intReturns the default port number for actor communication.booleanChecks if this discovery implementation is applicable to the current environment.
-
Method Details
-
getMyNodeId
String getMyNodeId()Returns the unique identifier for the current node.- Returns:
- the node ID
-
getMyHost
String getMyHost()Returns the hostname or IP address for the current node.- Returns:
- the host address
-
getMyPort
default int getMyPort()Returns the default port number for actor communication.This can be overridden by the user if needed.
- Returns:
- the port number
-
getAllNodes
Returns information about all nodes in the cluster.This includes the current node and all remote nodes.
- Returns:
- list of all node information
-
isApplicable
boolean isApplicable()Checks if this discovery implementation is applicable to the current environment.- Returns:
- true if this discovery can be used in current environment
-