public RepositoryKey get(RepositoryName name) throws DhtException, TimeoutException { Cell cell = table.get(name.asBytes(), colId.name()); if (cell == null) return null; return RepositoryKey.fromBytes(cell.getValue()); }
public RepositoryKey get(RepositoryName name) throws DhtException, TimeoutException { Cell cell = table.get(name.asBytes(), colId.name()); if (cell == null) return null; return RepositoryKey.fromBytes(cell.getValue()); }
public RepositoryKey get(RepositoryName name) throws DhtException, TimeoutException { CacheKey memKey = ns.key(name); Sync<Map<CacheKey, byte[]>> sync = Sync.create(); client.get(singleton(memKey), sync); Map<CacheKey, byte[]> result; try { result = sync.get(options.getTimeout()); } catch (InterruptedException e) { throw new TimeoutException(); } catch (TimeoutException timeout) { // Fall through and read the database directly. result = emptyMap(); } byte[] data = result.get(memKey); if (data != null) { if (data.length == 0) return null; return RepositoryKey.fromBytes(data); } RepositoryKey key = db.get(name); data = key != null ? key.asBytes() : new byte[0]; client.modify(singleton(Change.put(memKey, data)), none); return key; }
public RepositoryKey get(RepositoryName name) throws DhtException, TimeoutException { CacheKey memKey = ns.key(name); Sync<Map<CacheKey, byte[]>> sync = Sync.create(); client.get(singleton(memKey), sync); Map<CacheKey, byte[]> result; try { result = sync.get(options.getTimeout()); } catch (InterruptedException e) { throw new TimeoutException(); } catch (TimeoutException timeout) { // Fall through and read the database directly. result = emptyMap(); } byte[] data = result.get(memKey); if (data != null) { if (data.length == 0) return null; return RepositoryKey.fromBytes(data); } RepositoryKey key = db.get(name); data = key != null ? key.asBytes() : new byte[0]; client.modify(singleton(Change.put(memKey, data)), none); return key; }