Class OortMasterLong

  • All Implemented Interfaces:
    java.util.EventListener, org.cometd.bayeux.Bayeux.BayeuxListener, org.cometd.bayeux.server.ConfigurableServerChannel.ServerChannelListener, org.cometd.bayeux.server.ServerChannel.MessageListener, org.eclipse.jetty.util.component.LifeCycle

    public class OortMasterLong
    extends OortMasterService<java.lang.Long,​OortMasterLong.Context>

    A distributed counter service to be deployed on a Oort cluster that modifies a long value hosted in a "master" 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 OortMasterLong.Callback object that will be invoked on the requesting node when the result has been computed and transmitted back by the "master" node.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  OortMasterLong.Callback
      Callback invoked when the result of the operation on the counter is available, or when the operation failed.
      protected static class  OortMasterLong.Context  
      • Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
      • Nested classes/interfaces inherited from interface org.cometd.bayeux.server.ConfigurableServerChannel.ServerChannelListener

        org.cometd.bayeux.server.ConfigurableServerChannel.ServerChannelListener.Weak
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

        org.eclipse.jetty.util.component.LifeCycle.Listener
    • Field Summary

      • Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
    • Constructor Summary

      Constructors 
      Constructor Description
      OortMasterLong​(Oort oort, java.lang.String name, boolean master)  
      OortMasterLong​(Oort oort, java.lang.String name, boolean master, long initial)  
    • Constructor Detail

      • OortMasterLong

        public OortMasterLong​(Oort oort,
                              java.lang.String name,
                              boolean master)
      • OortMasterLong

        public OortMasterLong​(Oort oort,
                              java.lang.String name,
                              boolean master,
                              long initial)
        Parameters:
        oort - the oort this instance is associated to
        name - the name of this service
        master - whether this service lives on the "master" node
        initial - the initial local value