@Override public long size() { return excerpt.size(); }
public SocketGateway(final InetSocketAddress address, @NotNull Chronicle outbound, @NotNull Chronicle inbound, @NotNull WaitingThread waitingThread) { this.address = address; this.outbound = outbound; this.inbound = inbound; Excerpt out = outbound.createExcerpt(); out.index(out.size()); outboundReader = new GatewayEntryReader(out, true) { final ByteBuffer byteBuffer = ByteBuffer.allocateDirect(1 << 20); @Override protected void onEntry(long writeTimeNS, long writeTimeMS, long readTimeMS, int length, char type, @NotNull Excerpt excerpt) { if (type == 'X') return; byteBuffer.position(0); byteBuffer.limit(length); excerpt.read(byteBuffer); byteBuffer.flip(); try { assert socket != null; IOTools.writeAll(socket, byteBuffer); } catch (IOException e) { inboundWriter.onException("Failed to write", e); } } }; Excerpt in = inbound.createExcerpt(); in.index(in.size()); inboundWriter = new GatewayEntryWriter(in); waitingThread.add(this); }
case MASTER: excerpt = chronicle.createExcerpt(); long size = excerpt.size(); while (excerpt.index() < size && excerpt.nextIndex()) { processNextEvent(excerpt.index() <= lastEvent);
@Override public long size() { return excerpt.size(); }
public SocketGateway(final InetSocketAddress address, @NotNull Chronicle outbound, @NotNull Chronicle inbound, @NotNull WaitingThread waitingThread) { this.address = address; this.outbound = outbound; this.inbound = inbound; Excerpt out = outbound.createExcerpt(); out.index(out.size()); outboundReader = new GatewayEntryReader(out, true) { final ByteBuffer byteBuffer = ByteBuffer.allocateDirect(1 << 20); @Override protected void onEntry(long writeTimeNS, long writeTimeMS, long readTimeMS, int length, char type, @NotNull Excerpt excerpt) { if (type == 'X') return; byteBuffer.position(0); byteBuffer.limit(length); excerpt.read(byteBuffer); byteBuffer.flip(); try { assert socket != null; IOTools.writeAll(socket, byteBuffer); } catch (IOException e) { inboundWriter.onException("Failed to write", e); } } }; Excerpt in = inbound.createExcerpt(); in.index(in.size()); inboundWriter = new GatewayEntryWriter(in); waitingThread.add(this); }
case MASTER: excerpt = chronicle.createExcerpt(); long size = excerpt.size(); while (excerpt.index() < size && excerpt.nextIndex()) { processNextEvent(excerpt.index() <= lastEvent);