Search in sources :

Example 21 with BufferObjectDataOutput

use of com.hazelcast.internal.nio.BufferObjectDataOutput 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);
    }
}
Also used : BufferObjectDataOutput(com.hazelcast.internal.nio.BufferObjectDataOutput) IOException(java.io.IOException) BufferObjectDataInput(com.hazelcast.internal.nio.BufferObjectDataInput)

Aggregations

BufferObjectDataOutput (com.hazelcast.internal.nio.BufferObjectDataOutput)21 QuickTest (com.hazelcast.test.annotation.QuickTest)10 Test (org.junit.Test)10 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)9 BufferObjectDataInput (com.hazelcast.internal.nio.BufferObjectDataInput)6 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)3 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)3 IOException (java.io.IOException)3 ClassDefinition (com.hazelcast.nio.serialization.ClassDefinition)2 Address (com.hazelcast.cluster.Address)1 Connection (com.hazelcast.internal.nio.Connection)1 IOUtil.readData (com.hazelcast.internal.nio.IOUtil.readData)1 IOUtil.writeData (com.hazelcast.internal.nio.IOUtil.writeData)1 Data (com.hazelcast.internal.serialization.Data)1 SerializationUtil.createSerializerAdapter (com.hazelcast.internal.serialization.impl.SerializationUtil.createSerializerAdapter)1 BufferPool (com.hazelcast.internal.serialization.impl.bufferpool.BufferPool)1 CompactStreamSerializerAdapter (com.hazelcast.internal.serialization.impl.compact.CompactStreamSerializerAdapter)1 CompactWithSchemaStreamSerializerAdapter (com.hazelcast.internal.serialization.impl.compact.CompactWithSchemaStreamSerializerAdapter)1 ExecutionContext (com.hazelcast.jet.impl.execution.ExecutionContext)1 SenderReceiverKey (com.hazelcast.jet.impl.execution.ExecutionContext.SenderReceiverKey)1