@GridSpiNoop @GridSpiMultipleInstancesSupport(value=true) public class GridNoopCollisionSpi extends GridSpiAdapter implements GridCollisionSpi
GridCollisionSpi. This is default implementation
since 4.5.0 version. When grid is started with GridNoopCollisionSpi
jobs are activated immediately on arrival to mapped node. This approach suits well
for large amount of small jobs (which is a wide-spread use case). User still can
control the number of concurrent jobs by setting maximum thread pool size defined
by GridConfiguration.getExecutorService() configuration property.| Constructor and Description |
|---|
GridNoopCollisionSpi() |
| Modifier and Type | Method and Description |
|---|---|
void |
onCollision(GridCollisionContext ctx)
This is a callback called when either new grid job arrived or executing job finished its
execution.
|
void |
setExternalCollisionListener(GridCollisionExternalListener lsnr)
Listener to be set for notification of external collision events (e.g.
|
void |
spiStart(String gridName)
This method is called to start SPI.
|
void |
spiStop()
This method is called to stop SPI.
|
String |
toString() |
assertParameter, checkConfigurationConsistency0, configInfo, createSpiAttributeName, getConsistentAttributeNames, getGridGainHome, getLocalNodeId, getName, getNodeAttributes, getSpiContext, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, injectables, onContextDestroyed, onContextDestroyed0, onContextInitialized, onContextInitialized0, registerMBean, setName, startInfo, startStopwatch, stopInfo, unregisterMBeanclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetName, getNodeAttributes, onContextDestroyed, onContextInitializedpublic void spiStart(@Nullable String gridName) throws GridSpiException
spiStart in interface GridSpigridName - Name of grid instance this SPI is being started for
(null for default grid).GridSpiException - Throws in case of any error during SPI start.public void spiStop()
throws GridSpiException
Note that this method can be called at any point including during recovery of failed start. It should make no assumptions on what state SPI will be in when this method is called.
spiStop in interface GridSpiGridSpiException - Thrown in case of any error during SPI stop.public void onCollision(GridCollisionContext ctx)
Implementation of this method should act on all lists, each of which contains collision
job contexts that define a set of operations available during collision resolution. Refer
to GridCollisionContext and GridCollisionJobContext documentation for
more information.
onCollision in interface GridCollisionSpictx - Collision context which contains all collision lists.public void setExternalCollisionListener(@Nullable GridCollisionExternalListener lsnr)
GridGain uses this listener to enable job stealing from overloaded to underloaded nodes.
However, you can also utilize it, for instance, to provide time based collision
resolution. To achieve this, you most likely would mark some job by setting a certain
attribute in job context (see GridComputeJobContext) for a job that requires
time-based scheduling and set some timer in your SPI implementation that would wake up
after a certain period of time. Once this period is reached, you would notify this
listener that a collision resolution should take place. Then inside of your collision
resolution logic, you would find the marked waiting job and activate it.
Note that most collision SPI's might not have external collisions. In that case, they should simply ignore this method and do nothing when listener is set.
setExternalCollisionListener in interface GridCollisionSpilsnr - Listener for external collision events.Copyright © 2014. All rights reserved.