public class GridClientImpl extends Object implements GridClient, GridClientBeforeNodeStart
| Modifier and Type | Field and Description |
|---|---|
protected GridClientConfiguration |
cfg
Client configuration.
|
protected GridClientConnectionManager |
connMgr
Connection manager.
|
protected GridClientTopology |
top
Topology.
|
| Constructor and Description |
|---|
GridClientImpl(UUID id,
GridClientConfiguration cfg0,
boolean routerClient,
boolean beforeNodeStart)
Creates a new client based on a given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTopologyListener(GridClientTopologyListener lsnr)
Adds topology listener.
|
@Nullable GridClientNodeStateBeforeStart |
beforeStartState()
Getting a client projection of node state before its start.
|
GridClientException |
checkLastError()
Check for last topology errors.
|
void |
close()
Closes client instance.
|
GridClientCompute |
compute()
Gets a default compute projection.
|
boolean |
connected()
Indicates whether client is connected to remote Grid.
|
GridClientConnection |
connection()
Getting a client connection without topology information.
|
GridClientConnectionManager |
connectionManager() |
GridClientData |
data(@Nullable String cacheName)
Gets a data projection for grid cache with name cacheName.
|
UUID |
id()
Gets a unique client identifier.
|
GridClientConnectionManager |
newConnectionManager(@Nullable Byte marshId,
boolean routerClient) |
void |
removeTopologyListener(GridClientTopologyListener lsnr)
Removes previously added topology listener.
|
GridClientClusterState |
state()
Get client cluster state projection, for perform activate/deactivate operation on cluster.
|
void |
stop(boolean waitCompletion)
Closes client.
|
GridClientTopology |
topology()
Gets topology instance.
|
Collection<GridClientTopologyListener> |
topologyListeners()
Gets an unmodifiable snapshot of topology listeners list.
|
String |
toString() |
protected final GridClientConfiguration cfg
protected final GridClientTopology top
protected final GridClientConnectionManager connMgr
public GridClientImpl(UUID id, GridClientConfiguration cfg0, boolean routerClient, boolean beforeNodeStart) throws GridClientException
beforeNodeStart == true, topology will not be received/updated,
and there will also be errors when trying to work with topology, compute, state and cache.id - Client identifier.cfg0 - Client configuration.routerClient - Router client flag.beforeNodeStart - Connecting to a node before it start.GridClientException - If client configuration is incorrect.GridServerUnreachableException - If none of the servers specified in configuration can be reached.public UUID id()
id in interface GridClientid in interface GridClientBeforeNodeStartpublic void stop(boolean waitCompletion)
waitCompletion - If true will wait for all pending requests to be proceeded.public GridClientData data(@Nullable @Nullable String cacheName) throws GridClientException
data in interface GridClientcacheName - Grid cache name for which data projection should be obtained.GridClientException - If client was closed or no configuration with given name was provided.public GridClientCompute compute()
GridClientLoadBalancer provided in client configuration or
according to affinity if projection call involves affinity key.
More restricted projection configurations may be created with GridClientCompute methods.
compute in interface GridClientGridClientComputepublic GridClientClusterState state()
state in interface GridClientGridClientClusterStatepublic void addTopologyListener(GridClientTopologyListener lsnr)
GridClientConfiguration.getTopologyRefreshFrequency() milliseconds. If any node was added or removed,
a listener will be notified.addTopologyListener in interface GridClientlsnr - Listener to add.public void removeTopologyListener(GridClientTopologyListener lsnr)
removeTopologyListener in interface GridClientlsnr - Listener to remove.public Collection<GridClientTopologyListener> topologyListeners()
topologyListeners in interface GridClientpublic boolean connected()
GridClientDisconnectedException.
Connection status is updated in background together with topology update.
See GridClientConfiguration.getTopologyRefreshFrequency() for more
details on how background topology update works.
Note that due to asynchronous nature of topology update and connectivity detection this method gives no guarantees for subsequent calls for projections methods. It can be used only fo diagnostic and monitoring purposes.
connected in interface GridClientconnected in interface GridClientBeforeNodeStartpublic void close()
GridClientFactory.stop(clientId).
The method is invoked automatically on objects managed by the
try-with-resources statement.
close in interface AutoCloseableclose in interface GridClientclose in interface GridClientBeforeNodeStartpublic GridClientTopology topology()
public GridClientException checkLastError()
checkLastError in interface GridClientcheckLastError in interface GridClientBeforeNodeStartException if client was not connected.@Nullable public @Nullable GridClientNodeStateBeforeStart beforeStartState()
beforeStartState in interface GridClientBeforeNodeStartGridClientNodeStateBeforeStartpublic GridClientConnectionManager connectionManager()
public GridClientConnectionManager newConnectionManager(@Nullable @Nullable Byte marshId, boolean routerClient) throws GridClientException
GridClientException - If failed to start connection server.public GridClientConnection connection() throws GridClientException, InterruptedException
GridClientException - If failed.InterruptedException
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.11.0 Release Date : September 11 2021