Class DisposableByteBuffer

java.lang.Object
org.gridgain.internal.snapshots.buffer.DisposableByteBuffer
All Implemented Interfaces:
org.gridgain.internal.lang.Disposable

public class DisposableByteBuffer extends Object implements org.gridgain.internal.lang.Disposable
Wrapper of ByteBuffer with disposable mechanism.

After disposing the buffer is not accessible and should not be used. Storing and using a internal buffer in a class field and using it after dispose can lead to correctness issues because another resource may start write to it.

  • Constructor Details

    • DisposableByteBuffer

      public DisposableByteBuffer(ByteBuffer buffer, org.gridgain.internal.lang.Disposable disposable)
  • Method Details

    • buffer

      public ByteBuffer buffer()
      Returns a reference to the internal byte buffer or throws BufferAlreadyDisposedException if the instance has already been disposed.
    • dispose

      public void dispose()
      Specified by:
      dispose in interface org.gridgain.internal.lang.Disposable