com.hazelcast.client.impl.protocol.util
Interface AtomicBuffer

All Superinterfaces:
DirectBuffer, MutableDirectBuffer
All Known Implementing Classes:
UnsafeBuffer

public interface AtomicBuffer
extends MutableDirectBuffer

Abstraction over a range of buffer types that allows type to be accessed with memory ordering semantics.


Method Summary
 void addIntOrdered(int index, int increment)
          Add a value to a given index with ordered store semantics.
 void addLongOrdered(int index, long increment)
          Add a value to a given index with ordered store semantics.
 boolean compareAndSetInt(int index, int expectedValue, int updateValue)
          Atomic compare and set of a int given an expected value.
 boolean compareAndSetLong(int index, long expectedValue, long updateValue)
          Performs an atomic compare and set of a long, given an expected value.
 int getIntVolatile(int index)
          Get the value at a given index with volatile semantics.
 long getLongVolatile(int index)
          Get the value at a given index with volatile semantics.
 short getShortVolatile(int index)
          Get the value at a given index with volatile semantics.
 void putIntOrdered(int index, int value)
          Put a value to a given index with ordered semantics.
 void putIntVolatile(int index, int value)
          Put a value to a given index with volatile semantics.
 void putLongOrdered(int index, long value)
          Put a value to a given index with ordered store semantics.
 void putLongVolatile(int index, long value)
          Put a value to a given index with volatile semantics.
 void putShortVolatile(int index, short value)
          Put a value to a given index with volatile semantics.
 
Methods inherited from interface com.hazelcast.client.impl.protocol.util.MutableDirectBuffer
putByte, putBytes, putBytes, putBytes, putBytes, putBytes, putDouble, putDouble, putFloat, putFloat, putInt, putInt, putLong, putLong, putShort, putShort, putStringUtf8, putStringUtf8, putStringWithoutLengthUtf8, setMemory
 
Methods inherited from interface com.hazelcast.client.impl.protocol.util.DirectBuffer
addressOffset, boundsCheck, byteArray, byteBuffer, capacity, checkLimit, getByte, getBytes, getBytes, getBytes, getBytes, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getShort, getShort, getStringUtf8, getStringUtf8, getStringWithoutLengthUtf8, wrap, wrap, wrap, wrap, wrap, wrap, wrap
 

Method Detail

getLongVolatile

long getLongVolatile(int index)
Get the value at a given index with volatile semantics.

Parameters:
index - The index in bytes from where to get the value.
Returns:
The value retrieved from the given index.

putLongVolatile

void putLongVolatile(int index,
                     long value)
Put a value to a given index with volatile semantics.

Parameters:
index - The index in bytes for where to put the value.
value - The value to put at the given index.

putLongOrdered

void putLongOrdered(int index,
                    long value)
Put a value to a given index with ordered store semantics.

Parameters:
index - The index in bytes for where to put the value.
value - The value to put at the given index.

addLongOrdered

void addLongOrdered(int index,
                    long increment)
Add a value to a given index with ordered store semantics. Use a negative increment to decrement.

Parameters:
index - The index in bytes for where to increment or decrement the value.
increment - The increment or decrement by which the value at the index will be adjusted.

compareAndSetLong

boolean compareAndSetLong(int index,
                          long expectedValue,
                          long updateValue)
Performs an atomic compare and set of a long, given an expected value.

Parameters:
index - The index in bytes for where to put the value.
expectedValue - at to be compared The expected value that is compared to the value at the index.
updateValue - The value to be exchanged with the value at the index.
Returns:
true if the compare and put were successful, false otherwise.

getIntVolatile

int getIntVolatile(int index)
Get the value at a given index with volatile semantics.

Parameters:
index - The index in bytes from where to get the value.
Returns:
The value retrieved from the given index.

putIntVolatile

void putIntVolatile(int index,
                    int value)
Put a value to a given index with volatile semantics.

Parameters:
index - The index in bytes for where to put the value.
value - The value to put at the given index.

putIntOrdered

void putIntOrdered(int index,
                   int value)
Put a value to a given index with ordered semantics.

Parameters:
index - The index in bytes for where to put the value.
value - The value to put at the given index.

addIntOrdered

void addIntOrdered(int index,
                   int increment)
Add a value to a given index with ordered store semantics. Use a negative increment to decrement.

Parameters:
index - The index in bytes for where to put the value.
increment - by which the value at the index will be adjusted.

compareAndSetInt

boolean compareAndSetInt(int index,
                         int expectedValue,
                         int updateValue)
Atomic compare and set of a int given an expected value.

Parameters:
index - The index in bytes for where to put the value.
expectedValue - at to be compared The expected value that is compared to the value at the index.
updateValue - The value to be exchanged with the value at the index.
Returns:
true if the compare and put were successful, false otherwise.

getShortVolatile

short getShortVolatile(int index)
Get the value at a given index with volatile semantics.

Parameters:
index - The index in bytes from where to get the value.
Returns:
The value retrieved from the given index.

putShortVolatile

void putShortVolatile(int index,
                      short value)
Put a value to a given index with volatile semantics.

Parameters:
index - The index in bytes for where to put the value.
value - The value to put at the given index.


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.