use of com.hazelcast.concurrent.atomiclong.AtomicLongService in project hazelcast by hazelcast.
the class PartitionControlledIdTest method testIdGenerator.
@Test
public void testIdGenerator() throws Exception {
String partitionKey = "hazelcast";
HazelcastInstance hz = getHazelcastInstance(partitionKey);
IdGenerator idGenerator = hz.getIdGenerator("idgenerator@" + partitionKey);
idGenerator.newId();
assertEquals("idgenerator@" + partitionKey, idGenerator.getName());
assertEquals(partitionKey, idGenerator.getPartitionKey());
AtomicLongService service = getNodeEngine(hz).getService(AtomicLongService.SERVICE_NAME);
assertTrue(service.containsAtomicLong("hz:atomic:idGenerator:" + idGenerator.getName()));
}
use of com.hazelcast.concurrent.atomiclong.AtomicLongService in project hazelcast by hazelcast.
the class PartitionControlledIdTest method testAtomicLong.
@Test
public void testAtomicLong() throws Exception {
String partitionKey = "hazelcast";
HazelcastInstance hz = getHazelcastInstance(partitionKey);
IAtomicLong atomicLong = hz.getAtomicLong("atomiclong@" + partitionKey);
atomicLong.incrementAndGet();
assertEquals("atomiclong@" + partitionKey, atomicLong.getName());
assertEquals(partitionKey, atomicLong.getPartitionKey());
AtomicLongService service = getNodeEngine(hz).getService(AtomicLongService.SERVICE_NAME);
assertTrue(service.containsAtomicLong(atomicLong.getName()));
}
use of com.hazelcast.concurrent.atomiclong.AtomicLongService in project hazelcast by hazelcast.
the class AtomicLongReplicationOperation method run.
@Override
public void run() throws Exception {
AtomicLongService atomicLongService = getService();
for (Map.Entry<String, Long> longEntry : migrationData.entrySet()) {
String name = longEntry.getKey();
AtomicLongContainer atomicLongContainer = atomicLongService.getLongContainer(name);
Long value = longEntry.getValue();
atomicLongContainer.set(value);
}
}
Aggregations