E - the element typepublic class OortList<E> extends OortObject<List<E>>
A specialized oort object whose entity is a List.
OortList specializes OortObject and allows optimized replication of elements
across the cluster: instead of replicating the whole list, that may be contain a lot of elements,
only elements that are added or removed are replicated.
Applications can use addAndShare(Object[]) and removeAndShare(Object[])
to broadcast changes related to elements, as well as OortObject.setAndShare(Object) to
change the whole list.
When one or more elements are changed, OortList.ElementListeners are notified.
OortList.DeltaListener converts whole list updates triggered by OortObject.setAndShare(Object)
into events for OortList.ElementListeners, giving applications a single listener type to implement
their business logic.
| Modifier and Type | Class and Description |
|---|---|
static class |
OortList.DeltaListener<E>
An implementation of
Listener that converts whole list events into OortList.ElementListener events. |
static interface |
OortList.ElementListener<E>
Listener for element events that update the entity list, either locally or remotely.
|
OortObject.Data<T>, OortObject.Factory<T>, OortObject.Info<T>, OortObject.Listener<T>, OortObject.Merger<T,R>org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListenerorg.cometd.bayeux.server.ConfigurableServerChannel.Initializer.PersistentOort.CometListener.Adapter, Oort.CometListener.Eventlogger, OORT_OBJECTS_CHANNEL| Constructor and Description |
|---|
OortList(Oort oort,
String name,
OortObject.Factory<List<E>> factory) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addAndShare(E... elements)
Adds the given
elements to the local entity list,
and then broadcasts the addition to all nodes in the cluster. |
void |
addElementListener(OortList.ElementListener<E> listener) |
boolean |
contains(E element)
Returns whether the given
element is present in the local entity list of this node. |
boolean |
isPresent(E element)
Returns whether the given
element is present in one of the entity lists of all nodes. |
protected void |
onObject(Map<String,Object> data) |
boolean |
removeAndShare(E... elements)
Removes the given
elements to the local entity list,
and then broadcasts the removal to all nodes in the cluster. |
void |
removeElementListener(OortList.ElementListener<E> listener) |
addListener, cometJoined, cometLeft, configureChannel, deserialize, doStart, doStop, getChannelName, getFactory, getInfo, getInfoByObject, getInfos, getLocalSession, getName, getOort, iterator, merge, newInfo, nextVersion, notifyRemoved, notifyUpdated, pushInfo, removeListener, serialize, setAndShare, setInfo, toStringaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic OortList(Oort oort, String name, OortObject.Factory<List<E>> factory)
public void addElementListener(OortList.ElementListener<E> listener)
public void removeElementListener(OortList.ElementListener<E> listener)
public boolean contains(E element)
element is present in the local entity list of this node.
Differently from isPresent(Object), only the local entity list is scanned.element - the element to test for presenceelement is contained in the local entity list, false otherwisepublic boolean isPresent(E element)
element is present in one of the entity lists of all nodes.
Differently from contains(Object) entity lists of all nodes are scanned.element - the element to test for presenceelement is contained in one of the entity lists of all nodes, false otherwisepublic boolean addAndShare(E... elements)
Adds the given elements to the local entity list,
and then broadcasts the addition to all nodes in the cluster.
Calling this method triggers notifications OortList.ElementListeners,
both on this node and on remote nodes.
elements - the elements to addpublic boolean removeAndShare(E... elements)
Removes the given elements to the local entity list,
and then broadcasts the removal to all nodes in the cluster.
Calling this method triggers notifications OortList.ElementListeners,
both on this node and on remote nodes.
elements - the elements to removeCopyright © 2008–2015 Dojo Foundation. All rights reserved.