Skip to content

Commit

Permalink
Switch to write batch as autoclose
Browse files Browse the repository at this point in the history
  • Loading branch information
fireduck64 committed Nov 16, 2018
1 parent 6c00acd commit f1155a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
3 changes: 1 addition & 2 deletions lib/src/db/rocksdb/RocksDBMap.java
Expand Up @@ -78,9 +78,8 @@ public void remove(ByteString key)
@Override
public void putAll(SortedMap<ByteString, ByteString> m)
{
try
try(WriteBatch batch = new WriteBatch())
{
WriteBatch batch = new WriteBatch();

for(Map.Entry<ByteString, ByteString> e : m.entrySet())
{
Expand Down
11 changes: 2 additions & 9 deletions lib/src/db/rocksdb/RocksDBMapMutationSet.java
Expand Up @@ -86,9 +86,8 @@ public void add(ByteString key, ByteString value)
@Override
public void addAll(TreeMultimap<ByteString, ByteString> map)
{
try
try(WriteBatch batch = new WriteBatch())
{
WriteBatch batch = new WriteBatch();
byte b[]=new byte[0];

for(Map.Entry<ByteString, ByteString> me : map.entries())
Expand Down Expand Up @@ -127,9 +126,7 @@ public List<ByteString> getSet(ByteString key, int max_reply)

LinkedList<ByteString> set = new LinkedList<>();
int count = 0;
RocksIterator it = db.newIterator();

try
try(RocksIterator it = db.newIterator())
{
it.seek(dbKey.toByteArray());

Expand All @@ -147,10 +144,6 @@ public List<ByteString> getSet(ByteString key, int max_reply)
it.next();
}
}
finally
{
it.dispose();
}

return set;

Expand Down

0 comments on commit f1155a5

Please sign in to comment.