@SuppressWarnings("resource") Allocation allocate(int hintSize) { int totalSize = hintSize + ENTRY_OVERHEAD_SIZE; if (totalSize > slab.capacity() / 2) { throw new IllegalArgumentException(String.format("Hint of %s bytes is too large - the maximum size is %s", hintSize, slab.capacity() / 2)); } OpOrder.Group opGroup = appendOrder.start(); // will eventually be closed by the receiver of the allocation try { return allocate(totalSize, opGroup); } catch (Throwable t) { opGroup.close(); throw t; } }
@SuppressWarnings("resource") Allocation allocate(int hintSize) { int totalSize = hintSize + ENTRY_OVERHEAD_SIZE; if (totalSize > slab.capacity() / 2) { throw new IllegalArgumentException(String.format("Hint of %s bytes is too large - the maximum size is %s", hintSize, slab.capacity() / 2)); } OpOrder.Group opGroup = appendOrder.start(); // will eventually be closed by the receiver of the allocation try { return allocate(totalSize, opGroup); } catch (Throwable t) { opGroup.close(); throw t; } }
@SuppressWarnings("resource") Allocation allocate(int hintSize) { int totalSize = hintSize + ENTRY_OVERHEAD_SIZE; if (totalSize > slab.capacity() / 2) { throw new IllegalArgumentException(String.format("Hint of %s bytes is too large - the maximum size is %s", hintSize, slab.capacity() / 2)); } OpOrder.Group opGroup = appendOrder.start(); // will eventually be closed by the receiver of the allocation try { return allocate(totalSize, opGroup); } catch (Throwable t) { opGroup.close(); throw t; } }
/** * Allocate space in this buffer for the provided mutation, and return the allocated Allocation object. * Returns null if there is not enough space in this segment, and a new segment is needed. */ @SuppressWarnings("resource") //we pass the op order around Allocation allocate(Mutation mutation, int size) { final OpOrder.Group opGroup = appendOrder.start(); try { int position = allocate(size); if (position < 0) { opGroup.close(); return null; } markDirty(mutation, position); return new Allocation(this, opGroup, position, (ByteBuffer) buffer.duplicate().position(position).limit(position + size)); } catch (Throwable t) { opGroup.close(); throw t; } }
/** * Allocate space in this buffer for the provided mutation, and return the allocated Allocation object. * Returns null if there is not enough space in this segment, and a new segment is needed. */ Allocation allocate(Mutation mutation, int size) { final OpOrder.Group opGroup = appendOrder.start(); try { int position = allocate(size); if (position < 0) { opGroup.close(); return null; } markDirty(mutation, position); return new Allocation(this, opGroup, position, (ByteBuffer) buffer.duplicate().position(position).limit(position + size)); } catch (Throwable t) { opGroup.close(); throw t; } }
/** * Allocate space in this buffer for the provided mutation, and return the allocated Allocation object. * Returns null if there is not enough space in this segment, and a new segment is needed. */ @SuppressWarnings("resource") //we pass the op order around Allocation allocate(Mutation mutation, int size) { final OpOrder.Group opGroup = appendOrder.start(); try { int position = allocate(size); if (position < 0) { opGroup.close(); return null; } markDirty(mutation, position); return new Allocation(this, opGroup, position, (ByteBuffer) buffer.duplicate().position(position).limit(position + size)); } catch (Throwable t) { opGroup.close(); throw t; } }
/** * Allocate space in this buffer for the provided mutation, and return the allocated Allocation object. * Returns null if there is not enough space in this segment, and a new segment is needed. */ @SuppressWarnings("resource") //we pass the op order around Allocation allocate(Mutation mutation, int size) { final OpOrder.Group opGroup = appendOrder.start(); try { int position = allocate(size); if (position < 0) { opGroup.close(); return null; } markDirty(mutation, position); return new Allocation(this, opGroup, position, (ByteBuffer) buffer.duplicate().position(position).limit(position + size)); } catch (Throwable t) { opGroup.close(); throw t; } }
public void close() { opGroup.close(); }
void markWritten() { appendOp.close(); }
public void close() { opGroup.close(); }
void markWritten() { appendOp.close(); }
void markWritten() { appendOp.close(); }
public void close() { opGroup.close(); }
private Allocation allocate(int totalSize, OpOrder.Group opGroup) { int offset = allocateBytes(totalSize); if (offset < 0) { opGroup.close(); return null; } return new Allocation(offset, totalSize, opGroup); }
void markWritten() { appendOp.close(); }
private Allocation allocate(int totalSize, OpOrder.Group opGroup) { int offset = allocateBytes(totalSize); if (offset < 0) { opGroup.close(); return null; } return new Allocation(offset, totalSize, opGroup); }
private Allocation allocate(int totalSize, OpOrder.Group opGroup) { int offset = allocateBytes(totalSize); if (offset < 0) { opGroup.close(); return null; } return new Allocation(offset, totalSize, opGroup); }