Package com.Lomikel.HBaser
Class AsynchHBaseClient
java.lang.Object
com.Lomikel.DB.Client<org.apache.hadoop.hbase.client.Table,HBaseSchema>
com.Lomikel.HBaser.HBaseClient
com.Lomikel.HBaser.AsynchHBaseClient
- All Implemented Interfaces:
Runnable
AsynchHBaseClient
provides HBaseClient
scanning asynchronously.
Only some methods are available for asynchronous processing.
Only one asynchronous scanning Thread
is allowed.- Author:
- J.Hrivnac
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected int
protected AsynchHBaseProcessor
protected ConcurrentLinkedQueue<Map<String,
String>> protected String
protected boolean
protected boolean
protected String
protected boolean
protected String
protected long
protected long
private Thread
private static org.apache.logging.log4j.Logger
Logging . -
Constructor Summary
ConstructorsConstructorDescriptionAsynchHBaseClient
(String url) Create and connect to HBase.AsynchHBaseClient
(String zookeepers, int clientPort) Create and connect to HBase.AsynchHBaseClient
(String zookeepers, String clientPort) Create and connect to HBase. -
Method Summary
Modifier and TypeMethodDescriptionpoll()
Give next result (if available).poll
(int n) Give next several results (when available).void
run()
scan
(String key, String search, String filter, long start, long stop, boolean ifkey, boolean iftime, int timelimit) Scan with timelimit.scan2json
(String key, String search, String filter, long start, long stop, boolean ifkey, boolean iftime, int timelimit) Start scan assynchronously.boolean
scanning()
Tell, whether it is actually scanning.void
setLoopWait
(int t) Set the time parallel thread waits between actions.void
setMaxQueueSize
(int maxsize) Set maximum size of the queue.int
size()
The actual size of the queue.void
startScan
(String key, String search, String filter, long start, long stop, boolean ifkey, boolean iftime) Start scan assynchronously.void
stop()
Stop the scanning and remove all remaining results.void
stop
(boolean keep) Stop the scanning.Methods inherited from class com.Lomikel.HBaser.HBaseClient
addAlwaysColumns, addResult, addResult3D, clientPort, close, conf, connect, connect, connect, connect, create, dateFormat, delete, evaluator, isRangeScan, latests, processResults, put, put, repository, resultScanner, scan, scan3D, search3D, search3D, searchLimit, setAlwaysColumns, setDateFormat, setEvaluation, setEvaluation, setProcessor, setRangeScan, setRepository, setSearchLimit, setSearchOperator, setup, table, timeline, zookeepers
Methods inherited from class com.Lomikel.DB.Client
finalize, isReversed, limit, registerVertexType, rename, representation, representations, results2CVS, results2DF, results2List, results2String, scan, scan, scan, scan3D, scan3D, scan3D, schema, setLimit, setReversed, setSchema, setTableName, tableName
-
Field Details
-
_queue
-
_processor
-
_thread
-
_scanKey
-
_scanSearch
-
_scanFilter
-
_scanStart
-
_scanStop
-
_scanIfkey
-
_scanIftime
-
_doscan
-
_scanning
-
_loopWait
-
log
Logging .
-
-
Constructor Details
-
AsynchHBaseClient
Create and connect to HBase.- Parameters:
zookeepers
- The comma-separated list of zookeper ids.clientPort
- The client port.- Throws:
LomikelException
- If anything goes wrong.
-
AsynchHBaseClient
Create and connect to HBase.- Parameters:
zookeepers
- The comma-separated list of zookeper ids.clientPort
- The client port.- Throws:
LomikelException
- If anything goes wrong.
-
AsynchHBaseClient
Create and connect to HBase.- Parameters:
url
- The HBase url.- Throws:
LomikelException
- If anything goes wrong.
-
-
Method Details
-
run
-
startScan
public void startScan(String key, String search, String filter, long start, long stop, boolean ifkey, boolean iftime) Start scan assynchronously.- Parameters:
key
- The row key. Disables other search terms. It can be null.search
- The search terms as family:column:value,.... Key can be searched with family:column = key:key "pseudo-name". key:startKey and key:stopKey van restrict search to a key interval.Comparator
can be chosen as family:column:value:comparator among exact,prefix,substring,regex. The default for key is prefix, the default for columns is substring. The randomiser can be added with random:random:chance. It can be null. All searches are executed as prefix searches.filter
- The names of required values as family:column,.... * = all.start
- The time period start timestamp in ms. 0 means since the beginning.stop
- The time period stop timestamp in ms. 0 means till now.ifkey
- Whether give also entries keys (as key:key).iftime
- Whether give also entries timestamps (as key:time).
-
scan2json
public String scan2json(String key, String search, String filter, long start, long stop, boolean ifkey, boolean iftime, int timelimit) Start scan assynchronously. Present results as a JSON string.- Parameters:
key
- The row key. Disables other search terms. It can be null.search
- The search terms as family:column:value,.... Key can be searched with family:column = key:key "pseudo-name". key:startKey and key:stopKey van restrict search to a key interval.Comparator
can be chosen as family:column:value:comparator among exact,prefix,substring,regex. The default for key is prefix, the default for columns is substring. The randomiser can be added with random:random:chance. It can be null. All searches are executed as prefix searches.filter
- The names of required values as family:column,.... * = all.start
- The time period start timestamp in ms. 0 means since the beginning.stop
- The time period stop timestamp in ms. 0 means till now.ifkey
- Whether give also entries keys (as key:key).iftime
- Whether give also entries timestamps (as key:time).
-
scan
public Map<String,Map<String, scanString>> (String key, String search, String filter, long start, long stop, boolean ifkey, boolean iftime, int timelimit) Scan with timelimit.- Parameters:
key
- The row key. Disables other search terms. It can be null.search
- The search terms as family:column:value,.... Key can be searched with family:column = key:key "pseudo-name". key:startKey and key:stopKey van restrict search to a key interval.Comparator
can be chosen as family:column:value:comparator among exact,prefix,substring,regex. The default for key is prefix, the default for columns is substring. The randomiser can be added with random:random:chance. It can be null. All searches are executed as prefix searches.filter
- The names of required values as family:column,.... * = all.start
- The time period start timestamp in ms. 0 means since the beginning.stop
- The time period stop timestamp in ms. 0 means till now.ifkey
- Whether give also entries keys (as key:key).iftime
- Whether give also entries timestamps (as key:time).timelimit
- The scanning timelimit [s] after which the processus will be interrupted and only so far acquired results will be returned.- Returns:
- The
Map
ofMap
s of results as key-&t;{family:column->value}.
-
poll
Give next result (if available).- Returns:
- The available result.
-
poll
Give next several results (when available).- Parameters:
n
- The number of requested results.- Returns:
- The available results.
-
size
The actual size of the queue.- Returns:
- The number of available results.
-
scanning
Tell, whether it is actually scanning.- Returns:
- Whether it is actually scanning.
-
setMaxQueueSize
Set maximum size of the queue. Queue accumlation will stop till its size goes bellow this limit.- Parameters:
maxsize
- The maximum size of the queue. Default is 1000.
-
setLoopWait
Set the time parallel thread waits between actions.- Parameters:
t
- The time parallel thread waits between actions (in ms). The default is 1000ms.
-
stop
Stop the scanning and remove all remaining results. -
stop
Stop the scanning.- Parameters:
keep
- Whether to keep already accumulated results, or to remove them.
-