Package org.apache.hadoop.hbase
Class SharedConnection
java.lang.Object
org.apache.hadoop.hbase.SharedConnection
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Abortable
,Connection
Wraps a Connection to make it can't be closed or aborted.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Abort the server or client.void
Clear all the entries in the region location cache, for all the tables.void
close()
getAdmin()
Retrieve an Admin implementation to administer an HBase cluster.Retrieve aBufferedMutator
for performing client-side buffering of writes.getBufferedMutator
(TableName tableName) Retrieve aBufferedMutator
for performing client-side buffering of writes.Returns the cluster ID unique to this HBase cluster.org.apache.hadoop.conf.Configuration
Returns Configuration instance being used by this Connection instance.getHbck()
Retrieve an Hbck implementation to fix an HBase cluster.getHbck
(ServerName masterServer) Retrieve an Hbck implementation to fix an HBase cluster.getRegionLocator
(TableName tableName) Retrieve a RegionLocator implementation to inspect region information on a table.getTableBuilder
(TableName tableName, ExecutorService pool) Returns anTableBuilder
for creatingTable
.boolean
Check if the server or client was aborted.boolean
isClosed()
Returns whether the connection is closed or not.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.hadoop.hbase.client.Connection
getTable, getTable
-
Field Details
-
conn
-
-
Constructor Details
-
SharedConnection
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceConnection
- Throws:
IOException
-
isClosed
Description copied from interface:Connection
Returns whether the connection is closed or not.- Specified by:
isClosed
in interfaceConnection
- Returns:
- true if this connection is closed
-
abort
Description copied from interface:Abortable
Abort the server or client. -
isAborted
Description copied from interface:Abortable
Check if the server or client was aborted. -
getConfiguration
Description copied from interface:Connection
Returns Configuration instance being used by this Connection instance.- Specified by:
getConfiguration
in interfaceConnection
-
getBufferedMutator
Description copied from interface:Connection
Retrieve a
BufferedMutator
for performing client-side buffering of writes. TheBufferedMutator
returned by this method is thread-safe. This accessor will create a new ThreadPoolExecutor and will be shutdown once we close the BufferedMutator. This object can be used for long lived operations.The caller is responsible for calling
BufferedMutator.close()
on the returnedBufferedMutator
instance.- Specified by:
getBufferedMutator
in interfaceConnection
- Parameters:
tableName
- the name of the table- Returns:
- a
BufferedMutator
for the supplied tableName. - Throws:
IOException
-
getBufferedMutator
Description copied from interface:Connection
Retrieve aBufferedMutator
for performing client-side buffering of writes. TheBufferedMutator
returned by this method is thread-safe. This object can be used for long lived table operations. If user passes ThreadPool in BufferedMutatorParams then we will use that otherwise we will create for the user. For user specified ThreadPool, it is the user's responsibility to shutdown. For ThreadPool created by us, we will shutdown when user callsBufferedMutator.close()
. The caller is responsible for callingBufferedMutator.close()
on the returnedBufferedMutator
instance.- Specified by:
getBufferedMutator
in interfaceConnection
- Parameters:
params
- details on how to instantiate theBufferedMutator
.- Returns:
- a
BufferedMutator
for the supplied tableName. - Throws:
IOException
-
getRegionLocator
Description copied from interface:Connection
Retrieve a RegionLocator implementation to inspect region information on a table. The returned RegionLocator is not thread-safe, so a new instance should be created for each using thread. This is a lightweight operation. Pooling or caching of the returned RegionLocator is neither required nor desired.
The caller is responsible for callingCloseable.close()
on the returned RegionLocator instance. RegionLocator needs to be unmanaged- Specified by:
getRegionLocator
in interfaceConnection
- Parameters:
tableName
- Name of the table who's region is to be examined- Returns:
- A RegionLocator instance
- Throws:
IOException
-
getAdmin
Description copied from interface:Connection
Retrieve an Admin implementation to administer an HBase cluster. The returned Admin is not guaranteed to be thread-safe. A new instance should be created for each using thread. This is a lightweight operation. Pooling or caching of the returned Admin is not recommended.
The caller is responsible for callingAdmin.close()
on the returned Admin instance.- Specified by:
getAdmin
in interfaceConnection
- Returns:
- an Admin instance for cluster administration
- Throws:
IOException
-
getTableBuilder
Description copied from interface:Connection
Returns anTableBuilder
for creatingTable
.- Specified by:
getTableBuilder
in interfaceConnection
- Parameters:
tableName
- the name of the tablepool
- the thread pool to use for requests like batch and scan
-
clearRegionLocationCache
Description copied from interface:Connection
Clear all the entries in the region location cache, for all the tables. If you only want to clear the cache for a specific table, useRegionLocator.clearRegionLocationCache()
. This may cause performance issue so use it with caution.- Specified by:
clearRegionLocationCache
in interfaceConnection
-
getHbck
Description copied from interface:Connection
Retrieve an Hbck implementation to fix an HBase cluster. The returned Hbck is not guaranteed to be thread-safe. A new instance should be created by each thread. This is a lightweight operation. Pooling or caching of the returned Hbck instance is not recommended.
The caller is responsible for callingCloseable.close()
on the returned Hbck instance.
This will be used mostly by hbck tool.- Specified by:
getHbck
in interfaceConnection
- Returns:
- an Hbck instance for active master. Active master is fetched from the zookeeper.
- Throws:
IOException
-
getHbck
Description copied from interface:Connection
Retrieve an Hbck implementation to fix an HBase cluster. The returned Hbck is not guaranteed to be thread-safe. A new instance should be created by each thread. This is a lightweight operation. Pooling or caching of the returned Hbck instance is not recommended.
The caller is responsible for callingCloseable.close()
on the returned Hbck instance.
This will be used mostly by hbck tool. This may only be used to by pass getting registered master from ZK. In situations where ZK is not available or active master is not registered with ZK and user can get master address by other means, master can be explicitly specified.- Specified by:
getHbck
in interfaceConnection
- Parameters:
masterServer
- explicitServerName
for master server- Returns:
- an Hbck instance for a specified master server
- Throws:
IOException
-
getClusterId
Description copied from interface:Connection
Returns the cluster ID unique to this HBase cluster.
The default implementation is added to keep client compatibility.- Specified by:
getClusterId
in interfaceConnection
-