Class OortList<E>
- Type Parameters:
E- the element type
- All Implemented Interfaces:
Iterable<OortObject.Info<List<E>>>,EventListener,org.cometd.bayeux.server.ConfigurableServerChannel.Initializer,Oort.CometListener,org.eclipse.jetty.util.component.Dumpable,org.eclipse.jetty.util.component.LifeCycle
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(Result, Object[]) and removeAndShare(Result, Object[])
to broadcast changes related to elements, as well as OortObject.setAndShare(Object, Result) 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, Result)
into events for OortList.ElementListeners, giving applications a single listener type to implement
their business logic.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn implementation ofOortObject.Listenerthat converts whole list events intoOortList.ElementListenerevents.static interfaceListener for element events that update the entity list, either locally or remotely.Nested classes/interfaces inherited from class org.cometd.oort.OortObject
OortObject.Data<T>, OortObject.Factory<T>, OortObject.Info<T>, OortObject.Listener<T>, OortObject.Merger<T,R>, OortObject.Result<R> Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface org.cometd.bayeux.server.ConfigurableServerChannel.Initializer
org.cometd.bayeux.server.ConfigurableServerChannel.Initializer.PersistentNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainerNested classes/interfaces inherited from interface org.cometd.oort.Oort.CometListener
Oort.CometListener.Event -
Field Summary
Fields inherited from class org.cometd.oort.OortObject
OORT_OBJECTS_CHANNELFields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAndShare(OortObject.Result<Boolean> callback, E... elements) Adds the givenelementsto the local entity list, and then broadcasts the addition to all nodes in the cluster.voidaddElementListener(OortList.ElementListener<E> listener) booleanReturns whether the givenelementis present in the local entity list of this node.protected booleanisItemUpdate(Map<String, Object> data) booleanReturns whether the givenelementis present in one of the entity lists of all nodes.protected voidvoidremoveAndShare(OortObject.Result<Boolean> callback, E... elements) Removes the givenelementsto the local entity list, and then broadcasts the removal to all nodes in the cluster.voidremoveElementListener(OortList.ElementListener<E> listener) voidMethods inherited from class org.cometd.oort.OortContainer
cometLeft, doStop, onObjectMethods inherited from class org.cometd.oort.OortObject
addListener, cometJoined, configureChannel, deserialize, doStart, dump, getChannelName, getFactory, getInfo, getInfoByObject, getInfos, getLocalSession, getName, getOort, iterator, merge, newInfo, notifyRemoved, notifyUpdated, pullInfo, pushInfo, removeListener, removeListeners, serialize, setAndShare, toStringMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addEventListener, getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, setEventListeners, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dump, dumpSelfMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
OortList
-
-
Method Details
-
addElementListener
-
removeElementListener
-
removeElementListeners
public void removeElementListeners() -
contains
Returns whether the givenelementis present in the local entity list of this node. Differently fromisPresent(Object), only the local entity list is scanned.- Parameters:
element- the element to test for presence- Returns:
- true if the
elementis contained in the local entity list, false otherwise
-
isPresent
Returns whether the givenelementis present in one of the entity lists of all nodes. Differently fromcontains(Object)entity lists of all nodes are scanned.- Parameters:
element- the element to test for presence- Returns:
- true if the
elementis contained in one of the entity lists of all nodes, false otherwise
-
isItemUpdate
- Specified by:
isItemUpdatein classOortContainer<List<E>>
-
onItem
- Specified by:
onItemin classOortContainer<List<E>>
-