@IgniteSpiMultipleInstancesSupport(value=true) public class MemoryEventStorageSpi extends IgniteSpiAdapter implements EventStorageSpi, MemoryEventStorageSpiMBean
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). |
gridName, ignite| Constructor and Description |
|---|
MemoryEventStorageSpi() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearAll()
Removes all events from the event queue.
|
long |
getExpireAgeMs()
Gets event time-to-live value.
|
long |
getExpireCount()
Gets maximum event queue size.
|
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.
|
void |
setExpireAgeMs(long expireAgeMs)
Sets events expiration time.
|
void |
setExpireCount(long expireCnt)
Sets events queue size.
|
void |
setFilter(IgnitePredicate<Event> filter)
Sets filter for events to be recorded.
|
void |
spiStart(String gridName)
This method is called to start SPI.
|
void |
spiStop()
This method is called to stop SPI.
|
String |
toString() |
addTimeoutObject, assertParameter, checkConfigurationConsistency0, configInfo, createSpiAttributeName, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, getConsistentAttributeNames, getExceptionRegistry, getIgniteHome, getLocalNode, getLocalNodeId, getName, getNodeAttributes, getSpiContext, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, initFailureDetectionTimeout, injectables, injectResources, isNodeStopping, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextDestroyed0, onContextInitialized, onContextInitialized0, registerMBean, removeTimeoutObject, setName, startInfo, startStopwatch, stopInfo, unregisterMBeanclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitializedgetIgniteHome, getLocalNodeId, getName, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormattedpublic 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 void setFilter(IgnitePredicate<Event> filter)
filter - Filter to use.public void spiStart(String gridName) throws IgniteSpiException
spiStart in interface IgniteSpigridName - Name of grid instance this SPI is being started for
(null for default grid).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 IgniteSpiIgniteSpiException - Thrown in case of any error during SPI stop.@IgniteSpiConfiguration(optional=true) public void setExpireAgeMs(long expireAgeMs)
If not provided, default value is DFLT_EXPIRE_AGE_MS.
expireAgeMs - Expiration time in milliseconds.@IgniteSpiConfiguration(optional=true) public void setExpireCount(long expireCnt)
If not provided, default value DFLT_EXPIRE_COUNT will be used.
expireCnt - Maximum queue size.public long getExpireAgeMs()
getExpireAgeMs in interface MemoryEventStorageSpiMBeanpublic long getExpireCount()
getExpireCount in interface MemoryEventStorageSpiMBeanpublic long getQueueSize()
getQueueSize in interface MemoryEventStorageSpiMBeanpublic void clearAll()
clearAll in interface MemoryEventStorageSpiMBeanpublic <T extends Event> Collection<T> localEvents(IgnitePredicate<T> p)
localEvents in interface EventStorageSpip - Event predicate filter.public void record(Event evt) throws IgniteSpiException
record in interface EventStorageSpievt - Event that should be recorded.IgniteSpiException - If event recording failed for any reason.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.5.11 Release Date : April 8 2016