Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
YCSB
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adnan Ahmad
YCSB
Commits
d058bfcb
Commit
d058bfcb
authored
9 years ago
by
Biju Nair
Browse files
Options
Downloads
Patches
Plain Diff
[hbase10] Changes to use single HBase connection across all threads
parent
de0579e6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hbase10/src/main/java/com/yahoo/ycsb/db/HBaseClient10.java
+13
-3
13 additions, 3 deletions
hbase10/src/main/java/com/yahoo/ycsb/db/HBaseClient10.java
with
13 additions
and
3 deletions
hbase10/src/main/java/com/yahoo/ycsb/db/HBaseClient10.java
+
13
−
3
View file @
d058bfcb
...
...
@@ -51,6 +51,7 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Vector
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
* HBase 1.0 client for YCSB framework.
...
...
@@ -63,11 +64,12 @@ import java.util.Vector;
*/
public
class
HBaseClient10
extends
com
.
yahoo
.
ycsb
.
DB
{
private
Configuration
config
=
HBaseConfiguration
.
create
();
private
static
final
AtomicInteger
THREAD_COUNT
=
new
AtomicInteger
(
0
);
private
boolean
debug
=
false
;
private
String
tableName
=
""
;
private
Connection
connection
=
null
;
private
static
Connection
connection
=
null
;
// Depending on the value of clientSideBuffering, either bufferedMutator
// (clientSideBuffering) or currentTable (!clientSideBuffering) will be used.
...
...
@@ -130,7 +132,10 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB {
}
try
{
connection
=
ConnectionFactory
.
createConnection
(
config
);
THREAD_COUNT
.
getAndIncrement
();
synchronized
(
THREAD_COUNT
)
{
connection
=
ConnectionFactory
.
createConnection
(
config
);
}
}
catch
(
java
.
io
.
IOException
e
)
{
throw
new
DBException
(
e
);
}
...
...
@@ -185,7 +190,12 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB {
long
en
=
System
.
nanoTime
();
final
String
type
=
clientSideBuffering
?
"UPDATE"
:
"CLEANUP"
;
measurements
.
measure
(
type
,
(
int
)
((
en
-
st
)
/
1000
));
connection
.
close
();
synchronized
(
THREAD_COUNT
)
{
int
threadCount
=
THREAD_COUNT
.
decrementAndGet
();
if
(
threadCount
<=
0
&&
connection
!=
null
)
{
connection
.
close
();
}
}
}
catch
(
IOException
e
)
{
throw
new
DBException
(
e
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment