use of com.hazelcast.internal.nio.BufferObjectDataInput in project hazelcast by hazelcast.
the class BufferPoolTest method returnInputBuffer_whenOverflowing.
@Test
public void returnInputBuffer_whenOverflowing() {
for (int k = 0; k < BufferPoolImpl.MAX_POOLED_ITEMS; k++) {
bufferPool.returnInputBuffer(mock(BufferObjectDataInput.class));
}
BufferObjectDataInput in = mock(BufferObjectDataInput.class);
bufferPool.returnInputBuffer(in);
assertEquals(BufferPoolImpl.MAX_POOLED_ITEMS, bufferPool.inputQueue.size());
}
use of com.hazelcast.internal.nio.BufferObjectDataInput in project hazelcast by hazelcast.
the class OperationSerializationTest method copy.
private Operation copy(Operation op) {
try {
BufferObjectDataOutput out = serializationService.createObjectDataOutput(1000);
op.writeData(out);
BufferObjectDataInput in = serializationService.createObjectDataInput(out.toByteArray());
Constructor constructor = op.getClass().getConstructor();
constructor.setAccessible(true);
Operation copiedOperation = (Operation) constructor.newInstance();
copiedOperation.readData(in);
return copiedOperation;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of com.hazelcast.internal.nio.BufferObjectDataInput in project hazelcast by hazelcast.
the class RingbufferContainerSerializationTest method clone.
private RingbufferContainer clone(RingbufferContainer original) {
BufferObjectDataOutput out = serializationService.createObjectDataOutput(100000);
try {
out.writeObject(original);
byte[] bytes = out.toByteArray();
sleepMillis(CLOCK_DIFFERENCE_MS);
BufferObjectDataInput in = serializationService.createObjectDataInput(bytes);
RingbufferContainer clone = in.readObject();
return clone;
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
closeResource(out);
}
}
Aggregations