@Override public NavigableMap<K, V> subMap( K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) { return Maps.unmodifiableNavigableMap( delegate.subMap(fromKey, fromInclusive, toKey, toInclusive)); }
@Override public NavigableMap<K, V> tailMap(K fromKey, boolean inclusive) { return Maps.unmodifiableNavigableMap(delegate.tailMap(fromKey, inclusive)); } }
@Override public NavigableMap<K, V> headMap(K toKey, boolean inclusive) { return Maps.unmodifiableNavigableMap(delegate.headMap(toKey, inclusive)); }
@Override public NavigableMap<K, V> subMap( K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) { return Maps.unmodifiableNavigableMap( delegate.subMap(fromKey, fromInclusive, toKey, toInclusive)); }
@Override public NavigableMap<K, V> tailMap(K fromKey, boolean inclusive) { return Maps.unmodifiableNavigableMap(delegate.tailMap(fromKey, inclusive)); } }
@Override public NavigableMap<K, V> headMap(K toKey, boolean inclusive) { return Maps.unmodifiableNavigableMap(delegate.headMap(toKey, inclusive)); }
@Override protected SortedMap<String, String> create(Entry<String, String>[] entries) { SafeTreeMap<String, String> map = new SafeTreeMap<>(); putEntries(map, entries); return Maps.unmodifiableNavigableMap(map); } })
private void initPendingCommit() { HBaseProjectionCriteria criteria = new HBaseProjectionCriteria(); criteria.addColumnFamily(columnFamily); Get get = hbaseClient.constructGetRequests(prepareNamespace, criteria); try { Result[] results = hbaseClient.batchGet(Collections.singletonList(get)); Result result = results[0]; if (!result.isEmpty()) { LOG.debug("Loading previously prepared commit from {}", prepareNamespace); NavigableMap<byte[], byte[]> familyMap = result.getFamilyMap(columnFamily); pendingCommit = Maps.unmodifiableNavigableMap(familyMap); } else { LOG.debug("No previously prepared commits."); pendingCommit = EMPTY_PENDING_COMMIT_MAP; } } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void prepareCommit(long txid) { LOG.debug("prepareCommit txid {}", txid); validatePrepareTxid(txid); try { ConcurrentNavigableMap<byte[], byte[]> currentPending = pendingPrepare; pendingPrepare = createPendingPrepareMap(); Result result = getColumnFamily(prepareNamespace, columnFamily); if (!result.isEmpty()) { LOG.debug("Prepared txn already exists, will merge", txid); for (Map.Entry<byte[], byte[]> e : pendingCommit.entrySet()) { if (!currentPending.containsKey(e.getKey())) { currentPending.put(e.getKey(), e.getValue()); } } } else { LOG.debug("Nothing to save for prepareCommit, txid {}.", txid); } if (!currentPending.isEmpty()) { mutateRow(prepareNamespace, columnFamily, currentPending); } else { LOG.debug("Nothing to save for prepareCommit, txid {}.", txid); } txIds.put(PREPARE_TXID_KEY, String.valueOf(txid).getBytes()); mutateRow(txidNamespace, columnFamily, txIds); pendingCommit = Maps.unmodifiableNavigableMap(currentPending); } catch (Exception e) { throw new RuntimeException(e); } }
private void initPendingCommit() { RedisCommands commands = null; try { commands = container.getInstance(); if (commands.exists(prepareNamespace)) { LOG.debug("Loading previously prepared commit from {}", prepareNamespace); NavigableMap<byte[], byte[]> pendingCommitMap = new TreeMap<>(UnsignedBytes.lexicographicalComparator()); pendingCommitMap.putAll(commands.hgetAll(prepareNamespace)); pendingCommit = Maps.unmodifiableNavigableMap(pendingCommitMap); } else { LOG.debug("No previously prepared commits."); pendingCommit = EMPTY_PENDING_COMMIT_MAP; } } finally { container.returnInstance(commands); } }
@Override public void prepareCommit(long txid) { LOG.debug("prepareCommit txid {}", txid); validatePrepareTxid(txid); RedisCommands commands = null; try { ConcurrentNavigableMap<byte[], byte[]> currentPending = pendingPrepare; pendingPrepare = createPendingPrepareMap(); commands = container.getInstance(); if (commands.exists(prepareNamespace)) { LOG.debug("Prepared txn already exists, will merge", txid); for (Map.Entry<byte[], byte[]> e : pendingCommit.entrySet()) { if (!currentPending.containsKey(e.getKey())) { currentPending.put(e.getKey(), e.getValue()); } } } if (!currentPending.isEmpty()) { commands.hmset(prepareNamespace, currentPending); } else { LOG.debug("Nothing to save for prepareCommit, txid {}.", txid); } txIds.put(PREPARE_TXID_KEY, String.valueOf(txid)); commands.hmset(txidNamespace, txIds); pendingCommit = Maps.unmodifiableNavigableMap(currentPending); } finally { container.returnInstance(commands); } }
mod.put(3, "three"); NavigableMap<Integer, String> unmod = unmodifiableNavigableMap(mod);
/** * Returns the internal table. * * @return */ public Map<B, Multiset<A>> getInternalTable() { return Maps.unmodifiableNavigableMap(table); }
@Override public NavigableMap<K, V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) { return Maps.unmodifiableNavigableMap(delegate.subMap( fromKey, fromInclusive, toKey, toInclusive)); }
@Override public NavigableMap<K, V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) { return Maps.unmodifiableNavigableMap(delegate.subMap( fromKey, fromInclusive, toKey, toInclusive)); }
@Override public NavigableMap<K, V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) { return Maps.unmodifiableNavigableMap(delegate.subMap( fromKey, fromInclusive, toKey, toInclusive)); }
@Override public NavigableMap<K, V> tailMap(K fromKey, boolean inclusive) { return Maps.unmodifiableNavigableMap(delegate.tailMap(fromKey, inclusive)); } }
@Override public NavigableMap<K, V> headMap(K toKey, boolean inclusive) { return Maps.unmodifiableNavigableMap(delegate.headMap(toKey, inclusive)); }
@Override public NavigableMap<K, V> headMap(K toKey, boolean inclusive) { return Maps.unmodifiableNavigableMap(m_delegate.headMap(toKey, inclusive)); }
@Override public NavigableMap<K, V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) { return Maps.unmodifiableNavigableMap(delegate.subMap( fromKey, fromInclusive, toKey, toInclusive)); }