|
GridGain 3.6.0e
Enterprise Edition |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gridgain.grid.spi.GridSpiAdapter
org.gridgain.grid.spi.eventstorage.memory.GridMemoryEventStorageSpi
@GridSpiInfo(author="GridGain Systems",
url="www.gridgain.com",
email="support@gridgain.com",
version="3.6.0e.13012012")
@GridSpiMultipleInstancesSupport(value=true)
public class GridMemoryEventStorageSpi
In-memory GridEventStorageSpi implementation. All events are
kept in the FIFO queue. If no configuration is provided a default expiration
GridMemoryEventStorageSpi.DFLT_EXPIRE_AGE_MS and default count GridMemoryEventStorageSpi.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.
GridMemoryEventStorageSpi.setExpireCount(long))GridMemoryEventStorageSpi.setExpireAgeMs(long))GridMemoryEventStorageSpi.setFilter(org.gridgain.grid.lang.GridPredicate) - Event filter that should be used for decision to accept event.GridMemoryEventStorageSpi = new GridMemoryEventStorageSpi(); // Init own events size. spi.setExpireCount(2000); GridJexlPredicatefilter = new GridJexlPredicate ("event.taskName == 'task'", "event"); // Add filter. spi.setFilter(filter); GridConfigurationAdapter cfg = new GridConfigurationAdapter(); // Override default event storage SPI. cfg.setEventStorageSpi(spi); // Starts grid. G.start(cfg);
<bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfigurationAdapter" singleton="true">
...
<property name="discoverySpi">
<bean class="org.gridgain.grid.spi.eventStorage.memory.GridMemoryEventStorageSpi">
<property name="expireCount" value="2000"/>
<property name="filter">
<bean class="org.gridgain.grid.lang.GridJexlPredicate">
<property name="expression">
<value>
<![CDATA[elem.taskName == 'task']]>
</value>
</property>
</bean>
</property>
</bean>
</property>
...
</bean>
For information about Spring framework visit www.springframework.org
| Wiki | |
| Forum |
GridEventStorageSpi
![]() |
![]() |
![]() |
![]() |
| Field Summary | |
|---|---|
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). |
| Constructor Summary | |
|---|---|
GridMemoryEventStorageSpi()
|
|
| Method Summary | |
|---|---|
void |
clearAll()
Removes all events from the event queue. |
long |
getExpireAgeMs()
Gets event time-to-live value. |
long |
getExpireCount()
Gets maximum event queue size. |
GridPredicate<GridEvent> |
getFilter()
Gets filter for events to be recorded. |
long |
getQueueSize()
Gets current queue size of the event queue. |
Collection<GridEvent> |
localEvents(GridPredicate<? super GridEvent>... p)
Queries locally-stored events only. |
void |
record(GridEvent evt)
Records single event. |
void |
setExpireAgeMs(long expireAgeMs)
Sets events expiration time. |
void |
setExpireCount(long expireCnt)
Sets events queue size. |
void |
setFilter(GridPredicate<GridEvent> 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()
|
| Methods inherited from class org.gridgain.grid.spi.GridSpiAdapter |
|---|
assertParameter, checkConfigurationConsistency, configInfo, createSpiAttributeName, getAuthor, getConsistentAttributeNames, getGridGainHome, getLocalNodeId, getName, getNodeAttributes, getSpiContext, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion, injectables, onContextDestroyed, onContextInitialized, registerMBean, setJson, setName, startInfo, startStopwatch, stopInfo, unregisterMBean |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.gridgain.grid.spi.GridSpi |
|---|
getName, getNodeAttributes, onContextDestroyed, onContextInitialized |
| Methods inherited from interface org.gridgain.grid.spi.GridSpiJsonConfigurable |
|---|
setJson |
| Methods inherited from interface org.gridgain.grid.spi.GridSpiManagementMBean |
|---|
getAuthor, getGridGainHome, getLocalNodeId, getName, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion |
| Field Detail |
|---|
public static final long DFLT_EXPIRE_AGE_MS
Long.MAX_VALUE).
public static final int DFLT_EXPIRE_COUNT
10000).
| Constructor Detail |
|---|
public GridMemoryEventStorageSpi()
| Method Detail |
|---|
public GridPredicate<GridEvent> getFilter()
@GridSpiConfiguration(optional=true) public void setFilter(GridPredicate<GridEvent> filter)
filter - Filter to use.GridJexlPredicate
public void spiStart(String gridName)
throws GridSpiException
spiStart in interface GridSpiGridSpiException - Throws in case of any error during SPI start.gridName - Name of grid instance this SPI is being started for
(null for default grid).
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.@GridSpiConfiguration(optional=true) public void setExpireAgeMs(long expireAgeMs)
If not provided, default value is GridMemoryEventStorageSpi.DFLT_EXPIRE_AGE_MS.
expireAgeMs - Expiration time in milliseconds.@GridSpiConfiguration(optional=true) public void setExpireCount(long expireCnt)
If not provided, default value GridMemoryEventStorageSpi.DFLT_EXPIRE_COUNT will be used.
expireCnt - Maximum queue size.public long getExpireAgeMs()
getExpireAgeMs in interface GridMemoryEventStorageSpiMBeanpublic long getExpireCount()
getExpireCount in interface GridMemoryEventStorageSpiMBeanpublic long getQueueSize()
getQueueSize in interface GridMemoryEventStorageSpiMBeanpublic void clearAll()
clearAll in interface GridMemoryEventStorageSpiMBeanpublic Collection<GridEvent> localEvents(GridPredicate<? super GridEvent>... p)
localEvents in interface GridEventStorageSpip - Event predicate filters. If no filters are provided - all local events
will be returned.
public void record(GridEvent evt)
throws GridSpiException
record in interface GridEventStorageSpiGridSpiException - If event recording failed for any reason.evt - Event that should be recorded.public String toString()
toString in class Object
|
GridGain 3.6.0e
Enterprise Edition |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
|
GridGain - Real Time Big Data
|
|
|