class CASLong extends AnyRef
Implements atomic distributed Long using optimistic locking mechanism. The principle of changing the persisted counter/long value is to: 1) read the value from Consul including the latest ModificationIndex. 2) store the updated value to Consul using compare-and-set with the read ModificationIndex. Should the write fail due to concurrency issues, we loop back to step 1 and try again. Generally all operations will fail if there is no such key/path or the key doesn't have a numerical value.
- Alphabetic
- By Inheritance
- CASLong
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new CASLong(consulHost: ConsulHost, counterPath: String)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
def
currentValue(): Try[Long]
Attempts to read the current value of the long.
-
def
decrementAndGet(decrement: Long): Try[Long]
Tries to decrement the value by 'n' and return the new value.
Tries to decrement the value by 'n' and return the new value.
- decrement
The value to decrement with.
-
def
decrementAndGet(): Try[Long]
Tries to decrement the counter by one and return the new value.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
incrementAndGet(increment: Long): Try[Long]
Tries to increment the value by 'n' and return the new value.
Tries to increment the value by 'n' and return the new value.
- increment
The value to increment with.
-
def
incrementAndGet(): Try[Long]
Tries to increment the counter by one and return the new value.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated