public interface IgniteSpiContext
Modifier and Type | Method and Description |
---|---|
void |
addLocalEventListener(org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener lsnr,
int... types)
Adds an event listener for local events.
|
void |
addLocalMessageListener(@Nullable Object topic,
IgniteBiPredicate<UUID,?> p)
Register an local message listener to receive messages sent by remote nodes.
|
void |
addMessageListener(org.apache.ignite.internal.managers.communication.GridMessageListener lsnr,
String topic)
Deprecated.
Use
addLocalMessageListener(Object, IgniteBiPredicate) instead. |
void |
addTimeoutObject(IgniteSpiTimeoutObject c) |
SecuritySubject |
authenticatedSubject(UUID subjId)
Gets security subject based on subject ID.
|
Collection<SecuritySubject> |
authenticatedSubjects()
Gets collection of authenticated subjects together with their permissions.
|
boolean |
communicationFailureResolveSupported() |
<K> boolean |
containsKey(String cacheName,
K key)
Returns
true if this cache contains a mapping for the specified key. |
void |
deregisterPort(int port,
IgnitePortProtocol proto)
Deregisters closed port.
|
void |
deregisterPorts()
Deregisters all closed ports.
|
void |
failNode(UUID nodeId,
@Nullable String warning) |
<K,V> V |
get(String cacheName,
K key)
Gets object from cache.
|
boolean |
isEventRecordable(int... types)
Checks whether all provided event types are recordable.
|
boolean |
isStopping() |
ClusterNode |
localNode()
Gets local grid node.
|
MessageFactory |
messageFactory()
Gets message factory.
|
MessageFormatter |
messageFormatter()
Gets message formatter.
|
@Nullable ClusterNode |
node(UUID nodeId)
Gets a node instance based on its ID.
|
Map<String,Object> |
nodeAttributes() |
Collection<ClusterNode> |
nodes()
Gets a collection of all grid nodes.
|
int |
partition(String cacheName,
Object key)
Calculates partition number for given key.
|
boolean |
pingNode(UUID nodeId)
Pings a remote node.
|
<K,V> V |
put(String cacheName,
K key,
V val,
long ttl)
Puts object in cache.
|
<K,V> V |
putIfAbsent(String cacheName,
K key,
V val,
long ttl)
Puts object into cache if there was no previous object associated with
given key.
|
void |
recordEvent(Event evt)
Records local event.
|
void |
registerPort(int port,
IgnitePortProtocol proto)
Registers open port.
|
Collection<ClusterNode> |
remoteDaemonNodes()
Gets a collection of all remote daemon nodes in topology.
|
Collection<ClusterNode> |
remoteNodes()
Gets a collection of remote grid nodes.
|
<K,V> V |
remove(String cacheName,
K key)
Removes object from cache.
|
boolean |
removeLocalEventListener(org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener lsnr)
Removes local event listener.
|
void |
removeLocalMessageListener(@Nullable Object topic,
IgniteBiPredicate<UUID,?> p)
Removes a previously registered local message listener.
|
boolean |
removeMessageListener(org.apache.ignite.internal.managers.communication.GridMessageListener lsnr,
String topic)
Deprecated.
|
void |
removeTimeoutObject(IgniteSpiTimeoutObject c) |
void |
resolveCommunicationFailure(ClusterNode node,
Exception err) |
void |
send(ClusterNode node,
Serializable msg,
String topic)
Sends a message to a remote node.
|
boolean |
tryFailNode(UUID nodeId,
@Nullable String warning) |
@Nullable IgniteNodeValidationResult |
validateNode(ClusterNode node)
Validates that new node can join grid topology, this method is called on coordinator
node before new node joins topology.
|
@Nullable IgniteNodeValidationResult |
validateNode(ClusterNode node,
DiscoveryDataBag discoData) |
Collection<ClusterNode> remoteNodes()
DiscoverySpi
implementation used. Unlike nodes()
,
this method does not include local grid node.localNode()
,
nodes()
,
DiscoverySpi
Collection<ClusterNode> nodes()
DiscoverySpi
implementation used. Unlike remoteNodes()
,
this method does include local grid node.localNode()
,
remoteNodes()
,
DiscoverySpi
ClusterNode localNode()
DiscoverySpi
implementation used.DiscoverySpi
Collection<ClusterNode> remoteDaemonNodes()
DiscoverySpi
implementation used.localNode()
,
remoteNodes()
,
nodes()
,
DiscoverySpi
@Nullable @Nullable ClusterNode node(UUID nodeId)
nodeId
- ID of a node to get.null
is such not has not been discovered.DiscoverySpi
boolean pingNode(UUID nodeId)
DiscoverySpi.pingNode(UUID)
implementation.
Discovery SPIs usually have some latency in discovering failed nodes. Hence, communication to remote nodes may fail at times if an attempt was made to establish communication with a failed node. This method can be used to check if communication has failed due to node failure or due to some other reason.
nodeId
- ID of a node to ping.true
if node for a given ID is alive, false
otherwise.DiscoverySpi
void send(ClusterNode node, Serializable msg, String topic) throws IgniteSpiException
CommunicationSpi
implementation used.node
- Node to send a message to.msg
- Message to send.topic
- Topic to send message to.IgniteSpiException
- If failed to send a message to remote node.void addLocalMessageListener(@Nullable @Nullable Object topic, IgniteBiPredicate<UUID,?> p)
CommunicationSpi
implementation used.topic
- Topic to subscribe to.p
- Message predicate.void removeLocalMessageListener(@Nullable @Nullable Object topic, IgniteBiPredicate<UUID,?> p)
topic
- Topic to unsubscribe from.p
- Message predicate.@Deprecated void addMessageListener(org.apache.ignite.internal.managers.communication.GridMessageListener lsnr, String topic)
addLocalMessageListener(Object, IgniteBiPredicate)
instead.CommunicationSpi
implementation used.
This method can be used by jobs to communicate with other nodes in the grid. Remote nodes
can send messages by calling send(org.apache.ignite.cluster.ClusterNode, Serializable, String)
method.
lsnr
- Message listener to register.topic
- Topic to register listener for.@Deprecated boolean removeMessageListener(org.apache.ignite.internal.managers.communication.GridMessageListener lsnr, String topic)
removeLocalMessageListener(Object, IgniteBiPredicate)
instead.lsnr
- Message listener to remove.topic
- Topic to unregister listener for.true
of message listener was removed, false
if it was not
previously registered.void addLocalEventListener(org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener lsnr, int... types)
lsnr
- Event listener for local events.types
- Optional types for which this listener will be notified. If no types are provided
this listener will be notified for all local events.Event
boolean removeLocalEventListener(org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener lsnr)
lsnr
- Local event listener to remove.true
if listener was removed, false
otherwise.boolean isEventRecordable(int... types)
types
- Event types to check.void recordEvent(Event evt)
evt
- Local grid event to record.void registerPort(int port, IgnitePortProtocol proto)
port
- Port.proto
- Protocol.void deregisterPort(int port, IgnitePortProtocol proto)
port
- Port.proto
- Protocol.void deregisterPorts()
@Nullable <K,V> V get(String cacheName, K key) throws javax.cache.CacheException
cacheName
- Cache name.key
- Object key.javax.cache.CacheException
- Thrown if any exception occurs.@Nullable <K,V> V put(String cacheName, K key, V val, long ttl) throws javax.cache.CacheException
K
- Key type.V
- Value type.cacheName
- Cache name.key
- Object key.val
- Cached object.ttl
- Time to live, 0
means the entry will never expire.null
.javax.cache.CacheException
- Thrown if any exception occurs.@Nullable <K,V> V putIfAbsent(String cacheName, K key, V val, long ttl) throws javax.cache.CacheException
K
- Cache key type.V
- Cache value type.cacheName
- Cache name.key
- Cache key.val
- Cache value.ttl
- Time to live.null
if there was no value for given key.javax.cache.CacheException
- If put failed.@Nullable <K,V> V remove(String cacheName, K key) throws javax.cache.CacheException
K
- Key type.V
- Value type.cacheName
- Cache name.key
- Object key.null
.javax.cache.CacheException
- Thrown if any exception occurs.<K> boolean containsKey(String cacheName, K key)
true
if this cache contains a mapping for the specified key.K
- Key type.cacheName
- Cache name.key
- Object key.true
if this cache contains a mapping for the specified key.int partition(String cacheName, Object key)
cacheName
- Cache name.key
- Key.@Nullable @Nullable IgniteNodeValidationResult validateNode(ClusterNode node)
node
- Joining node.null
in case of success.@Nullable @Nullable IgniteNodeValidationResult validateNode(ClusterNode node, DiscoveryDataBag discoData)
node
- Node.discoData
- Disco data.Collection<SecuritySubject> authenticatedSubjects() throws IgniteException
IgniteException
- If any exception occurs.SecuritySubject authenticatedSubject(UUID subjId) throws IgniteException
subjId
- Subject ID.IgniteException
- If any exception occurs.MessageFormatter messageFormatter()
MessageFactory messageFactory()
boolean isStopping()
True
if node started shutdown sequence.boolean tryFailNode(UUID nodeId, @Nullable @Nullable String warning)
nodeId
- Node ID.warning
- Warning to be shown on all cluster nodes.void failNode(UUID nodeId, @Nullable @Nullable String warning)
nodeId
- Node ID.warning
- Warning to be shown on all cluster nodes.void addTimeoutObject(IgniteSpiTimeoutObject c)
c
- Timeout object.void removeTimeoutObject(IgniteSpiTimeoutObject c)
c
- Timeout object.boolean communicationFailureResolveSupported()
True
if cluster supports communication error resolving.void resolveCommunicationFailure(ClusterNode node, Exception err)
node
- Problem node.err
- Error.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019