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

public class AsynchHBaseClient extends HBaseClient implements 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 Details

  • Constructor Details

  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
    • 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,String>> scan(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 of Maps of results as key-&t;{family:column->value}.
    • poll

      Give next result (if available).
      Returns:
      The available result.
    • poll

      public Map<String,Map<String,String>> poll(int n)
      Give next several results (when available).
      Parameters:
      n - The number of requested results.
      Returns:
      The available results.
    • size

      public int size()
      The actual size of the queue.
      Returns:
      The number of available results.
    • scanning

      public boolean scanning()
      Tell, whether it is actually scanning.
      Returns:
      Whether it is actually scanning.
    • setMaxQueueSize

      public void setMaxQueueSize(int maxsize)
      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

      public void setLoopWait(int t)
      Set the time parallel thread waits between actions.
      Parameters:
      t - The time parallel thread waits between actions (in ms). The default is 1000ms.
    • stop

      public void stop()
      Stop the scanning and remove all remaining results.
    • stop

      public void stop(boolean keep)
      Stop the scanning.
      Parameters:
      keep - Whether to keep already accumulated results, or to remove them.