Class OortPrimaryLong

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
All Implemented Interfaces:
EventListener, Bayeux.BayeuxListener, ConfigurableServerChannel.ServerChannelListener, ServerChannel.MessageListener, org.eclipse.jetty.util.component.LifeCycle

public class OortPrimaryLong extends OortPrimaryService<Long,OortPrimaryLong.Context>

A distributed counter service to be deployed on a Oort cluster that modifies a long value hosted in a "primary" node.

Instances of this service may be used as unique ID generator, or as unique counter across the cluster, for example to aggregate values from different nodes, such as the number of users connected to each node.

Applications may call methods addAndGet(long, Callback) or getAndAdd(long, Callback) providing the amount to add (it may be negative) and a OortPrimaryLong.Callback object that will be invoked on the requesting node when the result has been computed and transmitted back by the "primary" node.

  • Constructor Details

    • OortPrimaryLong

      public OortPrimaryLong(Oort oort, String name, boolean primary)
    • OortPrimaryLong

      public OortPrimaryLong(Oort oort, String name, boolean primary, long initial)
      Parameters:
      oort - the oort this instance is associated to
      name - the name of this service
      primary - whether this service lives on the "primary" node
      initial - the initial local value
  • Method Details