Skip to content

Commit

Permalink
clean up htable after finishing get and put. Fixes twitter#206
Browse files Browse the repository at this point in the history
  • Loading branch information
mav911 committed Jan 13, 2014
1 parent 53a651e commit 169a4aa
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 Twitter inc.
* Copyright 2014 Twitter inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -74,6 +74,7 @@ trait HBaseStore {

val result = tbl.get(g)
val value = result.getValue(columnFamily.as[StringBytes], column.as[StringBytes])
tbl.close()
Option(value).map(v => valueInj.invert(v).get)
}

Expand All @@ -84,11 +85,13 @@ trait HBaseStore {
p.add(columnFamily.as[StringBytes], column.as[StringBytes], valueInj(v))
val tbl = pool.getTable(table)
tbl.put(p)
tbl.close()
}
case (k, None) => futurePool {
val delete = new Delete(keyInj(k))
val tbl = pool.getTable(table)
tbl.delete(delete)
tbl.close()
}
}
}
Expand Down

0 comments on commit 169a4aa

Please sign in to comment.