public class OpenGridCluster extends AbstractHost<OpenGridSession>
connect(int)
method to create
a session for interacting with the cluster. This class
is thread-safe, but the OpenGridSession
need
synchronization if used with multiple threads.
Typically, instances of this class are created and managed
by the OpenGridService
. It is possible to create ad-hoc,
unmanaged instances, but this is not recommended.Modifier and Type | Class and Description |
---|---|
static class |
OpenGridCluster.Info
Holds information about the Open Grid cluster together with
a timestamp for caching purposes.
|
Modifier and Type | Field and Description |
---|---|
private ClusterConfig |
config |
private java.lang.String |
id |
private OpenGridCluster.Info |
info |
private static org.slf4j.Logger |
logger |
Constructor and Description |
---|
OpenGridCluster(ConnectionInfo ci,
ClusterConfig config)
Creates a new Open Grid Cluster instance.
|
Modifier and Type | Method and Description |
---|---|
org.json.simple.JSONObject |
asJSONObject(JSONOptions options)
Get the configuration information for this cluster as a JSON
object.
|
OpenGridSession |
connect(int timeout)
Connect to the cluster.
|
OpenGridCluster.Info |
getClusterInfo()
Get information about the Open Grid cluster.
|
ClusterConfig |
getConfig()
Get configuration settings for this cluster.
|
java.lang.String |
getId()
Get the ID of this cluster.
|
java.lang.String |
getTmpFolder(java.lang.String jobName,
boolean debug)
Get the tmp folder for a job with the given name.
|
java.lang.String |
getWorkFolder(java.lang.String jobName)
Get the work folder for a job with the given name.
|
getConnectionInfo, internalConnect, toString
private static final org.slf4j.Logger logger
private final java.lang.String id
private final ClusterConfig config
private OpenGridCluster.Info info
public OpenGridCluster(ConnectionInfo ci, ClusterConfig config)
ci
- Connection information to access the clusterconfig
- Other configuration settingspublic java.lang.String getId()
public ClusterConfig getConfig()
public java.lang.String getWorkFolder(java.lang.String jobName)
public java.lang.String getTmpFolder(java.lang.String jobName, boolean debug)
public OpenGridCluster.Info getClusterInfo()
OpenGridSession.getHostInfo()
, OpenGridSession.getOpenGridInfo()
and OpenGridSession.getTimeAdjustment()
. In addition,
the information is cached for up to 1 hour.public OpenGridSession connect(int timeout)
AbstractSession.close()
the session after use.connect
in class AbstractHost<OpenGridSession>
timeout
- Timeout in seconds for the connection to be establishedpublic org.json.simple.JSONObject asJSONObject(JSONOptions options)
getId()
config: getConfig()
.ClusterConfig.asJSONObject(JSONOptions)
connection: AbstractHost.getConnectionInfo()
.ConnectionInfo.asJSONObject(JSONOptions)
Note that a new JSON object is created each time this method is
called. Clients should cache this information if they need to
re-used it.
More information about the cluster is also available by calling
getClusterInfo()
.