@IgniteSpiMultipleInstancesSupport(value=true) public class MemoryEventStorageSpi extends IgniteSpiAdapter implements EventStorageSpi
EventStorageSpi
implementation. All events are
kept in the FIFO queue. If no configuration is provided a default expiration
DFLT_EXPIRE_AGE_MS
and default count DFLT_EXPIRE_COUNT
will
be used.
It's recommended not to set huge size and unlimited TTL because this might
lead to consuming a lot of memory and result in OutOfMemoryError
.
Both event expiration time and maximum queue size could be changed at
runtime.
setExpireCount(long)
)setExpireAgeMs(long)
)setFilter(org.apache.ignite.lang.IgnitePredicate)
- Event filter that should be used for decision to accept event.MemoryEventStorageSpi = new MemoryEventStorageSpi(); // Init own events size. spi.setExpireCount(2000); IgniteConfiguration cfg = new IgniteConfiguration(); // Override default event storage SPI. cfg.setEventStorageSpi(spi); // Starts grid. G.start(cfg);
<bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true"> ... <property name="discoverySpi"> <bean class="org.apache.ignite.spi.eventStorage.memory.MemoryEventStorageSpi"> <property name="expireCount" value="2000"/> </bean> </property> ... </bean>
For information about Spring framework visit www.springframework.org
EventStorageSpi
Modifier and Type | Field and Description |
---|---|
static long |
DFLT_EXPIRE_AGE_MS
Default event time to live value in milliseconds (value is
Long.MAX_VALUE ). |
static int |
DFLT_EXPIRE_COUNT
Default expire count (value is
10000 ). |
ignite, igniteInstanceName
Constructor and Description |
---|
MemoryEventStorageSpi() |
Modifier and Type | Method and Description |
---|---|
void |
clearAll()
Removes all events from the event queue.
|
long |
getExpireAgeMs()
|
long |
getExpireCount()
|
IgnitePredicate<Event> |
getFilter()
Gets filter for events to be recorded.
|
long |
getQueueSize()
Gets current queue size of the event queue.
|
<T extends Event> |
localEvents(IgnitePredicate<T> p)
Queries locally-stored events only.
|
void |
record(Event evt)
Records single event.
|
MemoryEventStorageSpi |
setExpireAgeMs(long expireAgeMs)
Sets events expiration time.
|
MemoryEventStorageSpi |
setExpireCount(long expireCnt)
Sets events queue size.
|
MemoryEventStorageSpi |
setFilter(IgnitePredicate<Event> filter)
Sets filter for events to be recorded.
|
MemoryEventStorageSpi |
setName(String name)
Sets SPI name.
|
void |
spiStart(String igniteInstanceName)
This method is called to start SPI.
|
void |
spiStop()
This method is called to stop SPI.
|
String |
toString() |
addTimeoutObject, assertParameter, checkConfigurationConsistency0, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, getConsistentAttributeNames, getExceptionRegistry, getLocalNode, getName, getNodeAttributes, getSpiContext, ignite, initFailureDetectionTimeout, injectables, injectResources, isNodeStopping, onBeforeStart, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextDestroyed0, onContextInitialized, onContextInitialized0, registerMBean, removeTimeoutObject, started, startInfo, startStopwatch, stopInfo, unregisterMBean
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized
public static final long DFLT_EXPIRE_AGE_MS
Long.MAX_VALUE
).public static final int DFLT_EXPIRE_COUNT
10000
).public IgnitePredicate<Event> getFilter()
@IgniteSpiConfiguration(optional=true) public MemoryEventStorageSpi setFilter(IgnitePredicate<Event> filter)
filter
- Filter to use.this
for chaining.public void spiStart(String igniteInstanceName) throws IgniteSpiException
spiStart
in interface IgniteSpi
igniteInstanceName
- Name of Ignite instance this SPI is being started for
(null
for default Ignite instance).IgniteSpiException
- Throws in case of any error during SPI start.public void spiStop() throws IgniteSpiException
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 IgniteSpi
IgniteSpiException
- Thrown in case of any error during SPI stop.public long getExpireAgeMs()
@IgniteSpiConfiguration(optional=true) public MemoryEventStorageSpi setExpireAgeMs(long expireAgeMs)
If not provided, default value is DFLT_EXPIRE_AGE_MS
.
expireAgeMs
- Expiration time in milliseconds.this
for chaining.public long getExpireCount()
@IgniteSpiConfiguration(optional=true) public MemoryEventStorageSpi setExpireCount(long expireCnt)
If not provided, default value DFLT_EXPIRE_COUNT
will be used.
expireCnt
- Maximum queue size.this
for chaining.public long getQueueSize()
public void clearAll()
public <T extends Event> Collection<T> localEvents(IgnitePredicate<T> p)
localEvents
in interface EventStorageSpi
p
- Event predicate filter.public void record(Event evt) throws IgniteSpiException
record
in interface EventStorageSpi
evt
- Event that should be recorded.IgniteSpiException
- If event recording failed for any reason.public MemoryEventStorageSpi setName(String name)
setName
in class IgniteSpiAdapter
name
- SPI name.this
for chaining.
GridGain In-Memory Computing Platform : ver. 8.9.19 Release Date : April 10 2025