@Override public Location storeItem(ByteSequence data, byte type, boolean sync) throws IOException { // Write the packet our internal buffer. int size = data.getLength() + RECORD_HEAD_SPACE; final Location location = new Location(); location.setSize(size); location.setType(type); Journal.WriteCommand write = new Journal.WriteCommand(location, data, sync); WriteBatch batch = enqueue(write); location.setBatch(batch); if (sync) { try { batch.latch.await(); } catch (InterruptedException e) { throw new InterruptedIOException(); } IOException exception = batch.exception.get(); if (exception != null) { throw exception; } } return location; }
buff.writeByte(write.location.getType()); buff.write(write.data.getData(), write.data.getOffset(), write.data.getLength()); write = write.getNext();
buff.writeByte(write.location.getType()); buff.write(write.data.getData(), write.data.getOffset(), write.data.getLength()); write = write.getNext();
buff.writeByte(write.location.getType()); buff.write(write.data.getData(), write.data.getOffset(), write.data.getLength()); write = write.getNext();
buff.writeByte(write.location.getType()); buff.write(write.data.getData(), write.data.getOffset(), write.data.getLength()); write = write.getNext();
buff.writeByte(write.location.getType()); buff.write(write.data.getData(), write.data.getOffset(), write.data.getLength()); write = write.getNext();
buff.writeByte(write.location.getType()); buff.write(write.data.getData(), write.data.getOffset(), write.data.getLength()); write = write.getNext();
buff.writeByte(write.location.getType()); buff.write(write.data.getData(), write.data.getOffset(), write.data.getLength()); write = write.getNext();
@Override public Location storeItem(ByteSequence data, byte type, boolean sync) throws IOException { // Write the packet our internal buffer. int size = data.getLength() + RECORD_HEAD_SPACE; final Location location = new Location(); location.setSize(size); location.setType(type); Journal.WriteCommand write = new Journal.WriteCommand(location, data, sync); WriteBatch batch = enqueue(write); location.setBatch(batch); if (sync) { try { batch.latch.await(); } catch (InterruptedException e) { throw new InterruptedIOException(); } IOException exception = batch.exception.get(); if (exception != null) { throw exception; } } return location; }
@Override public Location storeItem(ByteSequence data, byte type, boolean sync) throws IOException { // Write the packet our internal buffer. int size = data.getLength() + RECORD_HEAD_SPACE; final Location location = new Location(); location.setSize(size); location.setType(type); Journal.WriteCommand write = new Journal.WriteCommand(location, data, sync); WriteBatch batch = enqueue(write); location.setBatch(batch); if (sync) { try { batch.latch.await(); } catch (InterruptedException e) { throw new InterruptedIOException(); } IOException exception = batch.exception.get(); if (exception != null) { throw exception; } } return location; }
@Override public Location storeItem(ByteSequence data, byte type, boolean sync) throws IOException { // Write the packet our internal buffer. int size = data.getLength() + RECORD_HEAD_SPACE; final Location location = new Location(); location.setSize(size); location.setType(type); Journal.WriteCommand write = new Journal.WriteCommand(location, data, sync); WriteBatch batch = enqueue(write); location.setBatch(batch); if (sync) { try { batch.latch.await(); } catch (InterruptedException e) { throw new InterruptedIOException(); } IOException exception = batch.exception.get(); if (exception != null) { throw exception; } } return location; }
protected void signalDone(WriteBatch wb) { // Now that the data is on disk, remove the writes from the in // flight // cache. Journal.WriteCommand write = wb.writes.getHead(); while (write != null) { if (!write.sync) { inflightWrites.remove(new Journal.WriteKey(write.location)); } if (write.onComplete != null && wb.exception.get() == null) { try { write.onComplete.run(); } catch (Throwable e) { logger.info("Add exception was raised while executing the run command for onComplete", e); } } write = write.getNext(); } // Signal any waiting threads that the write is on disk. wb.latch.countDown(); }
protected void signalDone(WriteBatch wb) { // Now that the data is on disk, remove the writes from the in // flight // cache. Journal.WriteCommand write = wb.writes.getHead(); while (write != null) { if (!write.sync) { inflightWrites.remove(new Journal.WriteKey(write.location)); } if (write.onComplete != null && wb.exception.get() == null) { try { write.onComplete.run(); } catch (Throwable e) { logger.info("Add exception was raised while executing the run command for onComplete", e); } } write = write.getNext(); } // Signal any waiting threads that the write is on disk. wb.latch.countDown(); }
private void signalDone(WriteBatch writeBatch) { // Now that the data is on disk, remove the writes from the in // flight cache and signal any onComplete requests. Journal.WriteCommand write = writeBatch.writes.getHead(); while (write != null) { if (!write.sync) { inflightWrites.remove(new Journal.WriteKey(write.location)); } if (write.onComplete != null) { try { write.onComplete.run(); } catch (Throwable e) { LOG.info("Add exception was raised while executing the run command for onComplete", e); } } write = write.getNext(); } } }
protected void signalDone(WriteBatch wb) { // Now that the data is on disk, remove the writes from the in // flight // cache. Journal.WriteCommand write = wb.writes.getHead(); while (write != null) { if (!write.sync) { inflightWrites.remove(new Journal.WriteKey(write.location)); } if (write.onComplete != null && wb.exception.get() == null) { try { write.onComplete.run(); } catch (Throwable e) { logger.info("Add exception was raised while executing the run command for onComplete", e); } } write = write.getNext(); } // Signal any waiting threads that the write is on disk. wb.latch.countDown(); }
private void signalDone(WriteBatch writeBatch) { // Now that the data is on disk, remove the writes from the in // flight cache and signal any onComplete requests. Journal.WriteCommand write = writeBatch.writes.getHead(); while (write != null) { if (!write.sync) { inflightWrites.remove(new Journal.WriteKey(write.location)); } if (write.onComplete != null) { try { write.onComplete.run(); } catch (Throwable e) { LOG.info("Add exception was raised while executing the run command for onComplete", e); } } write = write.getNext(); } } }
private void signalDone(WriteBatch writeBatch) { // Now that the data is on disk, remove the writes from the in // flight cache and signal any onComplete requests. Journal.WriteCommand write = writeBatch.writes.getHead(); while (write != null) { if (!write.sync) { inflightWrites.remove(new Journal.WriteKey(write.location)); } if (write.onComplete != null) { try { write.onComplete.run(); } catch (Throwable e) { LOG.info("Add exception was raised while executing the run command for onComplete", e); } } write = write.getNext(); } } }
@Override public Location storeItem(ByteSequence data, byte type, boolean sync) throws IOException { checkClosed(); // Write the packet our internal buffer. int size = data.getLength() + Journal.RECORD_HEAD_SPACE; final Location location = new Location(); location.setSize(size); location.setType(type); Journal.WriteCommand write = new Journal.WriteCommand(location, data, sync); enqueueWrite(write); if (sync) { writePendingBatch(); } return location; }
@Override public Location storeItem(ByteSequence data, byte type, boolean sync) throws IOException { checkClosed(); // Write the packet our internal buffer. int size = data.getLength() + Journal.RECORD_HEAD_SPACE; final Location location = new Location(); location.setSize(size); location.setType(type); Journal.WriteCommand write = new Journal.WriteCommand(location, data, sync); enqueueWrite(write); if (sync) { writePendingBatch(); } return location; }
@Override public Location storeItem(ByteSequence data, byte type, boolean sync) throws IOException { checkClosed(); // Write the packet our internal buffer. int size = data.getLength() + Journal.RECORD_HEAD_SPACE; final Location location = new Location(); location.setSize(size); location.setType(type); Journal.WriteCommand write = new Journal.WriteCommand(location, data, sync); enqueueWrite(write); if (sync) { writePendingBatch(); } return location; }