private ByteSlot acquireSlot() { ByteSlot slot = slotsCache.poll(); return slot != null ? slot : new ByteSlot(); }
@Override public void write(int b) { ensureCapacity(size + 1); buf[size++] = (byte)b; }
private void releaseSlot(final ByteSlot slot) { slot.reset(); slotsCache.offer(slot); }
protected long syncSlots(final FSDataOutputStream stream, final ByteSlot[] slots, final int offset, final int count) throws IOException { long totalSynced = 0; for (int i = 0; i < count; ++i) { final ByteSlot data = slots[offset + i]; data.writeTo(stream); totalSynced += data.size(); } syncStream(stream); sendPostSyncSignal(); if (LOG.isTraceEnabled()) { LOG.trace("Sync slots=" + count + '/' + syncMaxSlot + ", flushed=" + StringUtils.humanSize(totalSynced)); } return totalSynced; }
protected long syncSlots(final FSDataOutputStream stream, final ByteSlot[] slots, final int offset, final int count) throws IOException { long totalSynced = 0; for (int i = 0; i < count; ++i) { final ByteSlot data = slots[offset + i]; data.writeTo(stream); totalSynced += data.size(); } syncStream(stream); sendPostSyncSignal(); if (LOG.isTraceEnabled()) { LOG.trace("Sync slots=" + count + '/' + syncMaxSlot + ", flushed=" + StringUtils.humanSize(totalSynced)); } return totalSynced; }
protected long syncSlots(final FSDataOutputStream stream, final ByteSlot[] slots, final int offset, final int count) throws IOException { long totalSynced = 0; for (int i = 0; i < count; ++i) { final ByteSlot data = slots[offset + i]; data.writeTo(stream); totalSynced += data.size(); } syncStream(stream); sendPostSyncSignal(); if (LOG.isTraceEnabled()) { LOG.trace("Sync slots=" + count + '/' + syncMaxSlot + ", flushed=" + StringUtils.humanSize(totalSynced)); } return totalSynced; }
@Override public void write(byte[] b, int off, int len) { ensureCapacity(size + len); System.arraycopy(b, off, buf, size, len); size += len; }
slotsCache = new LinkedTransferQueue<>(); while (slotsCache.size() < numSlots) { slotsCache.offer(new ByteSlot());
private void releaseSlot(final ByteSlot slot) { slot.reset(); slotsCache.offer(slot); }
protected long syncSlots(FSDataOutputStream stream, ByteSlot[] slots, int offset, int count) throws IOException { long totalSynced = 0; for (int i = 0; i < count; ++i) { ByteSlot data = slots[offset + i]; data.writeTo(stream); totalSynced += data.size(); } if (useHsync) { stream.hsync(); } else { stream.hflush(); } sendPostSyncSignal(); if (LOG.isTraceEnabled()) { LOG.trace("Sync slots=" + count + '/' + slots.length + ", flushed=" + StringUtils.humanSize(totalSynced)); } return totalSynced; }
@Override public void write(int b) { ensureCapacity(size + 1); buf[size++] = (byte)b; }
private ByteSlot acquireSlot() { ByteSlot slot = slotsCache.poll(); return slot != null ? slot : new ByteSlot(); }
private void releaseSlot(final ByteSlot slot) { slot.reset(); slotsCache.offer(slot); }
@Override public void write(int b) { ensureCapacity(size + 1); buf[size++] = (byte)b; }
private ByteSlot acquireSlot() { ByteSlot slot = slotsCache.poll(); return slot != null ? slot : new ByteSlot(); }
private void releaseSlot(final ByteSlot slot) { slot.reset(); slotsCache.offer(slot); }
public void write(int b) { ensureCapacity(size + 1); buf[size++] = (byte)b; }
private ByteSlot acquireSlot() { ByteSlot slot = slotsCache.poll(); return slot != null ? slot : new ByteSlot(); }
@Override public void write(byte[] b, int off, int len) { ensureCapacity(size + len); System.arraycopy(b, off, buf, size, len); size += len; }
slotsCache = new LinkedTransferQueue(); while (slotsCache.size() < numSlots) { slotsCache.offer(new ByteSlot());