public class GridCacheProcessor extends GridProcessorAdapter
GridComponent.DiscoveryDataExchangeType
ctx, log
Constructor and Description |
---|
GridCacheProcessor(GridKernalContext ctx) |
Modifier and Type | Method and Description |
---|---|
void |
addCacheConfiguration(CacheConfiguration cacheCfg) |
<K,V> IgniteInternalCache<K,V> |
atomicsCache()
Gets utility cache for atomic data structures.
|
void |
awaitStarted() |
void |
blockGateway(DynamicCacheChangeRequest req) |
void |
blockGateways()
Blocks all available gateways
|
<K,V> IgniteInternalCache<K,V> |
cache(String name) |
CacheConfiguration |
cacheConfiguration(String name)
Get configuration for the given cache.
|
DynamicCacheDescriptor |
cacheDescriptor(int cacheId) |
DynamicCacheDescriptor |
cacheDescriptor(String name)
Get registered cache descriptor.
|
Collection<DynamicCacheDescriptor> |
cacheDescriptors() |
CacheMode |
cacheMode(String cacheName)
Gets cache mode.
|
Collection<String> |
cacheNames()
Gets a collection of currently started caches.
|
Collection<IgniteInternalCache<?,?>> |
caches() |
<T> T |
clone(T obj) |
void |
collectGridNodeData(DiscoveryDataBag dataBag)
Collects discovery data on nodes already in grid on receiving
TcpDiscoveryNodeAddedMessage . |
void |
collectJoiningNodeData(DiscoveryDataBag dataBag)
Collects discovery data on joining node before sending
TcpDiscoveryJoinRequestMessage request. |
void |
completeStartFuture(DynamicCacheChangeRequest req) |
<K,V> GridCacheSharedContext<K,V> |
context() |
IgniteInternalFuture<?> |
createFromTemplate(String cacheName)
Dynamically starts cache using template configuration.
|
void |
createMissingQueryCaches()
Starts client caches that do not exist yet.
|
GridComponent.DiscoveryDataExchangeType |
discoveryDataType()
Gets unique component type to distinguish components providing discovery data.
|
IgniteInternalFuture<?> |
dynamicCloseCache(String cacheName) |
IgniteInternalFuture<?> |
dynamicDestroyCache(String cacheName,
boolean checkThreadTx) |
IgniteInternalFuture<?> |
dynamicDestroyCaches(Collection<String> cacheNames,
boolean checkThreadTx) |
IgniteInternalFuture<?> |
dynamicStartCache(CacheConfiguration ccfg,
String cacheName,
NearCacheConfiguration nearCfg,
boolean failIfExists,
boolean failIfNotStarted,
boolean checkThreadTx)
Dynamically starts cache.
|
IgniteInternalFuture<?> |
dynamicStartCache(CacheConfiguration ccfg,
String cacheName,
NearCacheConfiguration nearCfg,
CacheType cacheType,
boolean failIfExists,
boolean failIfNotStarted,
boolean checkThreadTx)
Dynamically starts cache.
|
IgniteInternalFuture<?> |
dynamicStartCaches(Collection<CacheConfiguration> ccfgList,
boolean failIfExists,
boolean checkThreadTx)
Dynamically starts multiple caches.
|
CachePartitionExchangeWorkerTask |
exchangeTaskForCustomDiscoveryMessage(DiscoveryCustomMessage msg)
Create exchange worker task for custom discovery message.
|
IgniteInternalFuture<?> |
getOrCreateFromTemplate(String cacheName,
boolean checkThreadTx)
Dynamically starts cache using template configuration.
|
<K,V> IgniteInternalCache<K,V> |
getOrStartCache(String name) |
IgniteCacheProxy<?,?> |
getOrStartPublicCache(boolean start,
boolean inclLoc)
Gets public cache that can be used for query execution.
|
<K,V> GridCacheAdapter<K,V> |
internalCache(String name) |
Collection<GridCacheAdapter<?,?>> |
internalCaches() |
<K,V> IgniteCacheProxy<K,V> |
jcache(String name) |
Collection<IgniteCacheProxy<?,?>> |
jcaches() |
long |
lastDataVersion() |
boolean |
onCustomEvent(DiscoveryCustomMessage msg,
AffinityTopologyVersion topVer)
Callback invoked from discovery thread when discovery custom message is received.
|
void |
onDisconnected(IgniteFuture<?> reconnectFut)
Client disconnected callback.
|
void |
onDiscoveryEvent(int type,
ClusterNode node,
AffinityTopologyVersion topVer) |
void |
onExchangeDone(AffinityTopologyVersion topVer,
Collection<DynamicCacheChangeRequest> reqs,
Throwable err)
Callback invoked when first exchange future for dynamic cache is completed.
|
void |
onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)
Receives discovery data object from remote nodes (called
on new node during discovery process).
|
void |
onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)
Method is called on nodes that are already in grid (not on joining node).
|
void |
onKernalStart(boolean activeOnStart)
Callback that notifies that kernal has successfully started,
including all managers and processors.
|
void |
onKernalStop(boolean cancel)
Callback to notify that kernal is about to stop.
|
void |
onKernalStopCaches(boolean cancel) |
IgniteInternalFuture<?> |
onReconnected(boolean clusterRestarted)
Client reconnected callback.
|
void |
onUndeployed(ClassLoader ldr)
Callback invoked by deployment manager for whenever a class loader gets undeployed.
|
void |
prepareCacheStart(DynamicCacheChangeRequest req,
AffinityTopologyVersion topVer) |
void |
printMemoryStats()
Prints memory statistics (sizes of internal structures, etc.).
|
void |
processCustomExchangeTask(CachePartitionExchangeWorkerTask task)
Process custom exchange task.
|
<K,V> IgniteInternalCache<K,V> |
publicCache(String name) |
Collection<String> |
publicCacheNames()
Gets a collection of currently started public cache names.
|
Collection<IgniteCacheProxy<?,?>> |
publicCaches() |
<K,V> IgniteCacheProxy<K,V> |
publicJCache(String cacheName) |
<K,V> IgniteCacheProxy<K,V> |
publicJCache(String cacheName,
boolean failIfNotStarted,
boolean checkThreadTx) |
IgniteInternalFuture<?> |
resetCacheState(Collection<String> cacheNames)
Resets cache state after the cache has been moved to recovery state.
|
void |
start(boolean activeOnStart)
Starts grid component.
|
Collection<DynamicCacheChangeRequest> |
startAllCachesRequests() |
Collection<DynamicCacheDescriptor> |
startReceivedCaches(AffinityTopologyVersion topVer)
Starts statically configured caches received from remote nodes during exchange.
|
void |
stop(boolean cancel)
Stops grid component.
|
Collection<DynamicCacheChangeRequest> |
stopAllCachesRequests() |
void |
stopCaches(boolean cancel) |
boolean |
systemCache(String name) |
IgniteTransactionsEx |
transactions() |
<K,V> IgniteInternalCache<K,V> |
utilityCache()
Gets utility cache.
|
IgniteNodeValidationResult |
validateNode(ClusterNode node)
Validates that new node can join grid topology, this method is called on coordinator
node before new node joins topology.
|
assertParameter, toString
public GridCacheProcessor(GridKernalContext ctx)
ctx
- Kernal context.public CachePartitionExchangeWorkerTask exchangeTaskForCustomDiscoveryMessage(DiscoveryCustomMessage msg)
msg
- Custom discovery message.null
if message doesn't require any special processing.public void processCustomExchangeTask(CachePartitionExchangeWorkerTask task)
task
- Task.public void start(boolean activeOnStart) throws IgniteCheckedException
start
in interface GridComponent
start
in class GridProcessorAdapter
IgniteCheckedException
- Throws in case of any errors.public void onKernalStart(boolean activeOnStart) throws IgniteCheckedException
onKernalStart
in interface GridComponent
onKernalStart
in class GridProcessorAdapter
IgniteCheckedException
- Thrown in case of any errors.public void stop(boolean cancel) throws IgniteCheckedException
stop
in interface GridComponent
stop
in class GridProcessorAdapter
cancel
- If true
, then all ongoing tasks or jobs for relevant
components need to be cancelled.IgniteCheckedException
- Thrown in case of any errors.public void stopCaches(boolean cancel)
cancel
- Cancel.public void blockGateways()
public void onKernalStop(boolean cancel)
onKernalStop
in interface GridComponent
onKernalStop
in class GridProcessorAdapter
cancel
- Flag indicating whether jobs should be canceled.public void onKernalStopCaches(boolean cancel)
cancel
- Cancel.public void onDisconnected(IgniteFuture<?> reconnectFut) throws IgniteCheckedException
onDisconnected
in interface GridComponent
onDisconnected
in class GridProcessorAdapter
reconnectFut
- Reconnect future.IgniteCheckedException
- If failed.public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted) throws IgniteCheckedException
onReconnected
in interface GridComponent
onReconnected
in class GridProcessorAdapter
clusterRestarted
- Cluster restarted flag.IgniteCheckedException
- If failed.public void awaitStarted() throws IgniteCheckedException
IgniteCheckedException
- If failed to wait.public Collection<String> cacheNames()
public IgniteCacheProxy<?,?> getOrStartPublicCache(boolean start, boolean inclLoc) throws IgniteCheckedException
start
- Start cache.inclLoc
- Include local caches.null
if there is no suitable cache.IgniteCheckedException
public Collection<String> publicCacheNames()
public CacheMode cacheMode(String cacheName)
cacheName
- Cache name to check.public void prepareCacheStart(DynamicCacheChangeRequest req, AffinityTopologyVersion topVer) throws IgniteCheckedException
req
- Cache start request.topVer
- Topology version.IgniteCheckedException
- If failed.public Collection<DynamicCacheDescriptor> startReceivedCaches(AffinityTopologyVersion topVer) throws IgniteCheckedException
topVer
- Topology version.IgniteCheckedException
- If failed.public void blockGateway(DynamicCacheChangeRequest req)
req
- Stop request.public void onExchangeDone(AffinityTopologyVersion topVer, Collection<DynamicCacheChangeRequest> reqs, Throwable err)
topVer
- Completed topology version.reqs
- Change requests.err
- Error.public void completeStartFuture(DynamicCacheChangeRequest req)
req
- Request to complete future for.@Nullable public GridComponent.DiscoveryDataExchangeType discoveryDataType()
GridComponent.collectJoiningNodeData(DiscoveryDataBag)
or GridComponent.collectGridNodeData(DiscoveryDataBag)
.discoveryDataType
in interface GridComponent
discoveryDataType
in class GridProcessorAdapter
public void collectJoiningNodeData(DiscoveryDataBag dataBag)
TcpDiscoveryJoinRequestMessage
request.collectJoiningNodeData
in interface GridComponent
collectJoiningNodeData
in class GridProcessorAdapter
dataBag
- container object to store discovery data in.public void collectGridNodeData(DiscoveryDataBag dataBag)
TcpDiscoveryNodeAddedMessage
.collectGridNodeData
in interface GridComponent
collectGridNodeData
in class GridProcessorAdapter
dataBag
- container object to store discovery data in.public void onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)
onJoiningNodeDataReceived
in interface GridComponent
onJoiningNodeDataReceived
in class GridProcessorAdapter
data
- DiscoveryDataBag.JoiningNodeDiscoveryData
interface to retrieve discovery data of joining node.public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)
onGridDataReceived
in interface GridComponent
onGridDataReceived
in class GridProcessorAdapter
data
- DiscoveryDataBag.GridDiscoveryData
interface to retrieve discovery data collected on remote nodes
(data common for all nodes in grid and specific for each node).public IgniteInternalFuture<?> createFromTemplate(String cacheName)
cacheName
- Cache name.public IgniteInternalFuture<?> getOrCreateFromTemplate(String cacheName, boolean checkThreadTx)
cacheName
- Cache name.checkThreadTx
- If true
checks that current thread does not have active transactions.public IgniteInternalFuture<?> dynamicStartCache(@Nullable CacheConfiguration ccfg, String cacheName, @Nullable NearCacheConfiguration nearCfg, boolean failIfExists, boolean failIfNotStarted, boolean checkThreadTx)
ccfg
- Cache configuration.cacheName
- Cache name.nearCfg
- Near cache configuration.failIfExists
- Fail if exists flag.failIfNotStarted
- If true
fails if cache is not started.checkThreadTx
- If true
checks that current thread does not have active transactions.public IgniteInternalFuture<?> dynamicStartCache(@Nullable CacheConfiguration ccfg, String cacheName, @Nullable NearCacheConfiguration nearCfg, CacheType cacheType, boolean failIfExists, boolean failIfNotStarted, boolean checkThreadTx)
ccfg
- Cache configuration.cacheName
- Cache name.nearCfg
- Near cache configuration.cacheType
- Cache type.failIfExists
- Fail if exists flag.failIfNotStarted
- If true
fails if cache is not started.checkThreadTx
- If true
checks that current thread does not have active transactions.public IgniteInternalFuture<?> dynamicStartCaches(Collection<CacheConfiguration> ccfgList, boolean failIfExists, boolean checkThreadTx)
ccfgList
- Collection of cache configuration.failIfExists
- Fail if exists flag.checkThreadTx
- If true
checks that current thread does not have active transactions.public IgniteInternalFuture<?> dynamicDestroyCache(String cacheName, boolean checkThreadTx)
cacheName
- Cache name to destroy.checkThreadTx
- If true
checks that current thread does not have active transactions.public IgniteInternalFuture<?> dynamicDestroyCaches(Collection<String> cacheNames, boolean checkThreadTx)
cacheNames
- Collection of cache names to destroy.checkThreadTx
- If true
checks that current thread does not have active transactions.public IgniteInternalFuture<?> dynamicCloseCache(String cacheName)
cacheName
- Cache name to close.public IgniteInternalFuture<?> resetCacheState(Collection<String> cacheNames)
cacheNames
- Cache names.public Collection<DynamicCacheChangeRequest> startAllCachesRequests() throws IgniteCheckedException
IgniteCheckedException
public Collection<DynamicCacheChangeRequest> stopAllCachesRequests()
public void onDiscoveryEvent(int type, ClusterNode node, AffinityTopologyVersion topVer)
type
- Event type.node
- Event node.topVer
- Topology version.public boolean onCustomEvent(DiscoveryCustomMessage msg, AffinityTopologyVersion topVer)
msg
- Customer message.topVer
- Current topology version.True
if minor topology version should be increased.@Nullable public IgniteNodeValidationResult validateNode(ClusterNode node)
validateNode
in interface GridComponent
validateNode
in class GridProcessorAdapter
node
- Joining node.null
in case of success.public long lastDataVersion()
public <K,V> IgniteInternalCache<K,V> cache(String name)
K
- type of keys.V
- type of values.name
- Cache name.public <K,V> IgniteInternalCache<K,V> getOrStartCache(String name) throws IgniteCheckedException
name
- Cache name.IgniteCheckedException
- If failed.public Collection<IgniteInternalCache<?,?>> caches()
public Collection<IgniteCacheProxy<?,?>> jcaches()
public <K,V> IgniteInternalCache<K,V> utilityCache()
public <K,V> IgniteInternalCache<K,V> atomicsCache()
public <K,V> IgniteInternalCache<K,V> publicCache(String name)
K
- type of keys.V
- type of values.name
- Cache name.public <K,V> IgniteCacheProxy<K,V> publicJCache(String cacheName) throws IgniteCheckedException
K
- type of keys.V
- type of values.cacheName
- Cache name.IgniteCheckedException
- If failed.@Nullable public <K,V> IgniteCacheProxy<K,V> publicJCache(String cacheName, boolean failIfNotStarted, boolean checkThreadTx) throws IgniteCheckedException
cacheName
- Cache name.failIfNotStarted
- If true
throws IllegalArgumentException
if cache is not started,
otherwise returns null
in this case.checkThreadTx
- If true
checks that current thread does not have active transactions.IgniteCheckedException
- If failed.public CacheConfiguration cacheConfiguration(String name)
name
- Cache name.public DynamicCacheDescriptor cacheDescriptor(String name)
name
- Name.public Collection<DynamicCacheDescriptor> cacheDescriptors()
@Nullable public DynamicCacheDescriptor cacheDescriptor(int cacheId)
cacheId
- Cache ID.public void addCacheConfiguration(CacheConfiguration cacheCfg) throws IgniteCheckedException
cacheCfg
- Cache configuration template.IgniteCheckedException
- If failed.public <K,V> IgniteCacheProxy<K,V> jcache(String name)
name
- Cache name.public Collection<IgniteCacheProxy<?,?>> publicCaches()
public <K,V> GridCacheAdapter<K,V> internalCache(String name)
K
- type of keys.V
- type of values.name
- Cache name.public Collection<GridCacheAdapter<?,?>> internalCaches()
public boolean systemCache(String name)
name
- Cache name.True
if specified cache is system, false
otherwise.public void printMemoryStats()
printMemoryStats
in interface GridComponent
printMemoryStats
in class GridProcessorAdapter
public void onUndeployed(ClassLoader ldr)
ldr
- Class loader.public <K,V> GridCacheSharedContext<K,V> context()
public IgniteTransactionsEx transactions()
public void createMissingQueryCaches() throws IgniteCheckedException
IgniteCheckedException
- In case of error.public <T> T clone(T obj) throws IgniteCheckedException
obj
- Object to clone.IgniteCheckedException
- If failed.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017