public abstract class StreamerWindowAdapter<E> extends Object implements LifecycleAware, StreamerWindow<E>, StreamerWindowMBean
| Constructor and Description |
|---|
StreamerWindowAdapter() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
checkConfiguration()
Check window configuration.
|
void |
clearEvicted()
Clears all evicted entries.
|
E |
dequeue()
Dequeues last element from windows.
|
Collection<E> |
dequeue(int cnt)
Dequeues up to
cnt elements from window. |
protected abstract Collection<E> |
dequeue0(int cnt)
Dequeues up to cnt elements from window.
|
Collection<E> |
dequeueAll()
Dequeues all elements from window.
|
boolean |
enqueue(E... evts)
Adds events to window.
|
boolean |
enqueue(E evt)
Adds single event to window.
|
protected abstract boolean |
enqueue0(E evt)
Adds event to window.
|
boolean |
enqueueAll(Collection<E> evts)
Adds all events to window.
|
String |
getClassName()
Gets window class name.
|
int |
getEvictionQueueSize()
Gets estimate for window eviction queue size.
|
IgnitePredicate<Object> |
getFilter()
Gets optional event filter.
|
String |
getName()
Gets window name.
|
int |
getSize()
Gets current window size.
|
<K,V> StreamerIndex<E,K,V> |
index()
Gets default index, if default index is not configured then
IllegalArgumentException will be thrown. |
<K,V> StreamerIndex<E,K,V> |
index(String name)
Gets index by name, if not index with such name was configured then
IllegalArgumentException will be thrown. |
Collection<StreamerIndex<E,?,?>> |
indexes()
Gets all indexes configured for this window.
|
StreamerIndexProvider<E,?,?>[] |
indexProviders()
Get array of index providers.
|
Iterator<E> |
iterator() |
protected abstract GridStreamerWindowIterator<E> |
iterator0()
Returns an iterator over a set of elements of type T without check for iteration limit.
|
String |
name()
Gets window name.
|
E |
pollEvicted()
If window supports eviction, this method will return next evicted element.
|
Collection<E> |
pollEvicted(int cnt)
If window supports eviction, this method will return up to
cnt evicted elements. |
protected abstract Collection<E> |
pollEvicted0(int cnt)
If window supports eviction, this method will return up to cnt evicted elements.
|
Collection<E> |
pollEvictedAll()
If window supports eviction, this method will return all available evicted elements.
|
Collection<E> |
pollEvictedBatch()
If window supports batch eviction, this method will poll next evicted batch from window.
|
protected abstract Collection<E> |
pollEvictedBatch0()
If window supports batch eviction, this method will poll next evicted batch from window.
|
void |
reset()
Resets window.
|
protected abstract void |
reset0()
Reset routine.
|
void |
setFilter(IgnitePredicate<Object> filter)
Sets event filter.
|
void |
setIndexes(StreamerIndexProvider<E,?,?>... idxs)
Set indexes.
|
void |
setName(String name)
Sets window name.
|
Collection<E> |
snapshot(boolean includeEvicted)
Create window snapshot.
|
void |
start()
Starts grid component, called on grid start.
|
void |
stop()
Stops grid component, called on grid shutdown.
|
protected abstract void |
stop0()
Dispose window.
|
protected void |
updateIndexes(E evt,
boolean rmv)
Update indexes.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitevictionQueueSize, sizepublic String getClassName()
getClassName in interface StreamerWindowMBeanpublic int getSize()
getSize in interface StreamerWindowMBeanpublic int getEvictionQueueSize()
getEvictionQueueSize in interface StreamerWindowMBeanpublic String name()
name in interface StreamerWindow<E>public String getName()
getName in interface StreamerWindowMBeanprotected abstract GridStreamerWindowIterator<E> iterator0()
public boolean enqueue(E evt)
enqueue in interface StreamerWindow<E>evt - Event to add.True if event was added.public boolean enqueue(E... evts)
enqueue in interface StreamerWindow<E>evts - Events to add.public boolean enqueueAll(Collection<E> evts)
enqueueAll in interface StreamerWindow<E>evts - Collection of events to add.True if all events were added, false if at
least 1 event was skipped.protected abstract boolean enqueue0(E evt)
evt - Event.True if event added.public E dequeue()
null if window is empty.dequeue in interface StreamerWindow<E>public Collection<E> dequeueAll()
dequeueAll in interface StreamerWindow<E>public Collection<E> dequeue(int cnt)
cnt elements from window. If current window size is less than cnt,
will dequeue all elements from window.dequeue in interface StreamerWindow<E>cnt - Count to dequeue.protected abstract Collection<E> dequeue0(int cnt)
cnt - Count.public E pollEvicted()
pollEvicted in interface StreamerWindow<E>null if eviction queue is empty or if
window does not support eviction.public Collection<E> pollEvictedAll()
pollEvictedAll in interface StreamerWindow<E>public Collection<E> pollEvicted(int cnt)
cnt evicted elements.pollEvicted in interface StreamerWindow<E>cnt - Number of elements to evict.protected abstract Collection<E> pollEvicted0(int cnt)
cnt - Count.public Collection<E> pollEvictedBatch()
pollEvictedBatch in interface StreamerWindow<E>protected abstract Collection<E> pollEvictedBatch0()
public final void start()
start in interface LifecycleAwarepublic final void reset()
reset in interface StreamerWindow<E>protected abstract void checkConfiguration()
throws IgniteException
IgniteException - If failed.protected abstract void reset0()
public void stop()
stop in interface LifecycleAwareprotected abstract void stop0()
public Collection<E> snapshot(boolean includeEvicted)
snapshot in interface StreamerWindow<E>includeEvicted - Whether to include evicted entries or not.public void setName(String name)
name - Window name.@Nullable public IgnitePredicate<Object> getFilter()
public void setFilter(@Nullable IgnitePredicate<Object> filter)
filter - Event filter.public <K,V> StreamerIndex<E,K,V> index()
IllegalArgumentException will be thrown.index in interface StreamerWindow<E>K - Type of the index key.V - Type of the index value.public <K,V> StreamerIndex<E,K,V> index(@Nullable String name)
IllegalArgumentException will be thrown.index in interface StreamerWindow<E>K - Type of the index key.V - Type of the index value.name - Name of the index, if null then analogous to StreamerWindow.index().public Collection<StreamerIndex<E,?,?>> indexes()
indexes in interface StreamerWindow<E>public StreamerIndexProvider<E,?,?>[] indexProviders()
public void setIndexes(StreamerIndexProvider<E,?,?>... idxs) throws IllegalArgumentException
idxs - Indexes.IllegalArgumentException - If some index names are not unique.public void clearEvicted()
clearEvicted in interface StreamerWindow<E>protected void updateIndexes(E evt, boolean rmv) throws IgniteException
evt - Event.rmv - Remove flag.IgniteException - If index update failed.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC3 Release Date : March 24 2015