@Override public long size() { return chronicle.size(); }
@Override public long size() { return chronicle.size(); }
public void startAtEnd() { start(chronicle.size() - 1); }
@Nullable private SocketChannel createConnection() { if (closed) { return null; } do { try { SocketChannel sc = SocketChannel.open(address); ByteBuffer bb = ByteBuffer.allocate(8); bb.putLong(0, chronicle.size()); IOTools.writeAllOrEOF(sc, bb); return sc; } catch (IOException e) { if (logger.isLoggable(Level.FINE)) logger.log(Level.FINE, "Failed to connect to " + address + " retrying", e); else if (logger.isLoggable(Level.INFO)) logger.log(Level.INFO, "Failed to connect to " + address + " retrying " + e); } } while (!closed); return null; } }
@Nullable private SocketChannel createConnection() { while (!closed) { try { readBuffer.clear(); readBuffer.limit(0); SocketChannel sc = SocketChannel.open(address); sc.socket().setReceiveBufferSize(256 * 1024); logger.info("Connected to " + address); ByteBuffer bb = ByteBuffer.allocate(8); bb.putLong(0, chronicle.size()); IOTools.writeAllOrEOF(sc, bb); return sc; } catch (IOException e) { if (logger.isLoggable(Level.FINE)) logger.log(Level.FINE, "Failed to connect to " + address + " retrying", e); else if (logger.isLoggable(Level.INFO)) logger.log(Level.INFO, "Failed to connect to " + address + " retrying " + e); } try { Thread.sleep(500); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return null; } } return null; }
public PackedHashedTable(String basePath, int hashBucketBits, int hashCapacityBits, int maxRecordSize) throws IOException { this.basePath = basePath; this.maxRecordSize = maxRecordSize; hash = new IntIndexedChronicle(basePath + ".hash", Math.min(24, hashCapacityBits - 4)); hashRecord = new HashRecord(hash.createExcerpt(), hashBucketBits, hashCapacityBits); while (hash.size() < 1 << hashBucketBits) hashRecord.addEntry(); records = new IntIndexedChronicle(basePath + ".record", Math.min(26, hashCapacityBits - 2)); recordsExcerpt = records.createExcerpt(); }
@Override public long size() { return chronicle.size(); }
@Override public long size() { return chronicle.size(); }
public void startAtEnd() { start(chronicle.size() - 1); }
@Nullable private SocketChannel createConnection() { if (closed) { return null; } do { try { SocketChannel sc = SocketChannel.open(address); ByteBuffer bb = ByteBuffer.allocate(8); bb.putLong(0, chronicle.size()); IOTools.writeAllOrEOF(sc, bb); return sc; } catch (IOException e) { if (logger.isLoggable(Level.FINE)) logger.log(Level.FINE, "Failed to connect to " + address + " retrying", e); else if (logger.isLoggable(Level.INFO)) logger.log(Level.INFO, "Failed to connect to " + address + " retrying " + e); } } while (!closed); return null; } }
@Nullable private SocketChannel createConnection() { while (!closed) { try { readBuffer.clear(); readBuffer.limit(0); SocketChannel sc = SocketChannel.open(address); sc.socket().setReceiveBufferSize(256 * 1024); logger.info("Connected to " + address); ByteBuffer bb = ByteBuffer.allocate(8); bb.putLong(0, chronicle.size()); IOTools.writeAllOrEOF(sc, bb); return sc; } catch (IOException e) { if (logger.isLoggable(Level.FINE)) logger.log(Level.FINE, "Failed to connect to " + address + " retrying", e); else if (logger.isLoggable(Level.INFO)) logger.log(Level.INFO, "Failed to connect to " + address + " retrying " + e); } try { Thread.sleep(500); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return null; } } return null; }