public abstract class HbaseSynchronizationManager
extends java.lang.Object
HbaseInterceptor to bind a table to the thread.
Each subsequent call made through HbaseTemplate is aware of the table bound and will use it instead of retrieving a new instance.| Constructor and Description |
|---|
HbaseSynchronizationManager() |
| Modifier and Type | Method and Description |
|---|---|
static void |
bindResource(java.lang.String key,
org.apache.hadoop.hbase.client.HTableInterface value)
Binds the given resource for the given key to the current thread.
|
static org.apache.hadoop.hbase.client.HTableInterface |
getResource(java.lang.Object key)
Returns the resource (table) associated with the given key.
|
static java.util.Set<java.lang.String> |
getTableNames()
Returns the bound tables (by name).
|
static boolean |
hasResource(java.lang.Object key)
Checks whether any resource is bound for the given key.
|
static org.apache.hadoop.hbase.client.HTableInterface |
unbindResource(java.lang.String key)
Unbinds a resource for the given key from the current thread.
|
static java.lang.Object |
unbindResourceIfPossible(java.lang.Object key)
Unbinds a resource for the given key from the current thread.
|
public static boolean hasResource(java.lang.Object key)
key - key to checkpublic static org.apache.hadoop.hbase.client.HTableInterface getResource(java.lang.Object key)
key - association keypublic static void bindResource(java.lang.String key,
org.apache.hadoop.hbase.client.HTableInterface value)
throws java.lang.IllegalStateException
key - the key to bind the value to (usually the resource factory)value - the value to bind (usually the active resource object)java.lang.IllegalStateException - if there is already a value bound to the threadResourceTransactionManager.getResourceFactory()public static org.apache.hadoop.hbase.client.HTableInterface unbindResource(java.lang.String key)
throws java.lang.IllegalStateException
key - the key to unbind (usually the resource factory)java.lang.IllegalStateException - if there is no value bound to the threadResourceTransactionManager.getResourceFactory()public static java.lang.Object unbindResourceIfPossible(java.lang.Object key)
key - the key to unbind (usually the resource factory)null if none boundpublic static java.util.Set<java.lang.String> getTableNames()