public ClientIdGeneratorProxy(string serviceName, string objectId, IAtomicLong atomicLong) : base(serviceName, objectId) { _atomicLong = atomicLong; _residue = new AtomicInteger(BlockSize); _local = new AtomicLong(-1); }
public ClientIdGeneratorProxy(string serviceName, string objectId, IAtomicLong atomicLong) : base(serviceName, objectId) { _atomicLong = atomicLong; _residue = new AtomicInteger(BlockSize); _local = new AtomicLong(-1); }
/// <summary> /// Invokes action. /// </summary> public void Invoke() { IAtomicLong atomicLong = _ignite.GetAtomicLong(AtomicLongName, 0, true); for (int i = 0; i < 20; i++) { Console.WriteLine(">>> AtomicLong value has been incremented: " + atomicLong.Increment()); } }
private CLRAtomicLong() { switch (RelaEngine.Mode) { case EngineMode.Test: _atomic = new AtomicLong(); break; case EngineMode.Live: _atomic = new Live.LiveAtomicLong(); break; default: throw new EngineException($"{nameof(CLRAtomicInt)} must only be used when RelaEngine.Mode is {EngineMode.Test} or {EngineMode.Live}, but it is {RelaEngine.Mode} (did you forget to assign it?)."); } }
public static void Main() { using (IIgnite ignite = Ignition.Start(Utils.GetServerNodeConfiguration())) { Console.WriteLine(); Console.WriteLine(">>> Atomic long example started."); IAtomicLong atomicLong = ignite.GetAtomicLong(AtomicLongIncrementAction.AtomicLongName, 0, true); Console.WriteLine(">>> Atomic long initial value: " + atomicLong.Read()); // Broadcast an action that increments AtomicLong a number of times. ignite.GetCompute().Broadcast(new AtomicLongIncrementAction()); // Actual value will depend on a number of participating nodes. Console.WriteLine("\n>>> Atomic long current value: " + atomicLong.Read()); } Console.WriteLine(); Console.WriteLine(">>> Example finished, press any key to exit ..."); Console.ReadKey(); }
public static void Main() { using (var ignite = Ignition.StartFromApplicationConfiguration()) { Console.WriteLine(); Console.WriteLine(">>> Atomic long example started."); IAtomicLong atomicLong = ignite.GetAtomicLong(AtomicLongIncrementAction.AtomicLongName, 0, true); Console.WriteLine(">>> Atomic long initial value: " + atomicLong.Read()); ignite.GetCompute().Broadcast(new AtomicLongIncrementAction()); Console.WriteLine("\n>>> Atomic long current value: " + atomicLong.Read()); } Console.WriteLine("\n>>> Check output on all nodes."); Console.WriteLine("\n>>> Example finished, press any key to exit ..."); Console.ReadKey(); }
public void Init() { l = Client.GetAtomicLong(TestSupport.RandomString()); l.Set(0); }
public void Init() { l = Client.GetAtomicLong(TestSupport.RandomString()); l.Set(0); }
private readonly ICache<Relation, byte> _relations; // Map from relation id to relation type #endregion Fields #region Constructors private Repository() { _persons = _ignite.GetCache<long, IPerson>("persons"); _relations = _ignite.GetCache<Relation, byte>("relations"); _idCounter = _ignite.GetAtomicLong("IgniteDemoIdCounter", 0, true); }