Class MockBufferedMutator

  • All Implemented Interfaces:
    Closeable, AutoCloseable, org.apache.hadoop.hbase.client.BufferedMutator

    public class MockBufferedMutator
    extends Object
    implements org.apache.hadoop.hbase.client.BufferedMutator
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.client.BufferedMutator

        org.apache.hadoop.hbase.client.BufferedMutator.ExceptionListener
    • Field Summary

      • Fields inherited from interface org.apache.hadoop.hbase.client.BufferedMutator

        CLASSNAME_KEY, MIN_WRITE_BUFFER_PERIODIC_FLUSH_TIMERTICK_MS
    • Constructor Summary

      Constructors 
      Constructor Description
      MockBufferedMutator​(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.TableName name, org.apache.hadoop.conf.Configuration config)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Performs a flush() and releases any resources held.
      void flush()
      Executes all the buffered, asynchronous Mutation operations and waits until they are done.
      org.apache.hadoop.conf.Configuration getConfiguration()
      Returns the Configuration object used by this instance.
      org.apache.hadoop.hbase.TableName getName()
      Gets the fully qualified table name instance of the table that this BufferedMutator writes to.
      long getWriteBufferSize()
      Returns the maximum size in bytes of the write buffer for this HTable.
      void mutate​(List<? extends org.apache.hadoop.hbase.client.Mutation> ms)
      Send some Mutations to the table.
      void mutate​(org.apache.hadoop.hbase.client.Mutation mutation)
      Sends a Mutation to the table.
      void setOperationTimeout​(int timeout)  
      void setRpcTimeout​(int timeout)  
      • Methods inherited from interface org.apache.hadoop.hbase.client.BufferedMutator

        disableWriteBufferPeriodicFlush, getWriteBufferPeriodicFlushTimeoutMs, getWriteBufferPeriodicFlushTimerTickMs, setWriteBufferPeriodicFlush, setWriteBufferPeriodicFlush
    • Constructor Detail

      • MockBufferedMutator

        public MockBufferedMutator​(org.apache.hadoop.hbase.client.Connection conn,
                                   org.apache.hadoop.hbase.TableName name,
                                   org.apache.hadoop.conf.Configuration config)
    • Method Detail

      • getName

        public org.apache.hadoop.hbase.TableName getName()
        Gets the fully qualified table name instance of the table that this BufferedMutator writes to.
        Specified by:
        getName in interface org.apache.hadoop.hbase.client.BufferedMutator
      • getConfiguration

        public org.apache.hadoop.conf.Configuration getConfiguration()
        Returns the Configuration object used by this instance.

        The reference returned is not a copy, so any change made to it will affect this instance.

        Specified by:
        getConfiguration in interface org.apache.hadoop.hbase.client.BufferedMutator
      • mutate

        public void mutate​(org.apache.hadoop.hbase.client.Mutation mutation)
        Sends a Mutation to the table. The mutations will be buffered and sent over the wire as part of a batch. Currently only supports Put and Delete mutations.
        Specified by:
        mutate in interface org.apache.hadoop.hbase.client.BufferedMutator
        Parameters:
        mutation - The data to send.
      • mutate

        public void mutate​(List<? extends org.apache.hadoop.hbase.client.Mutation> ms)
                    throws IOException
        Send some Mutations to the table. The mutations will be buffered and sent over the wire as part of a batch. There is no guarantee of sending entire content of mutations in a single batch; it will be broken up according to the write buffer capacity.
        Specified by:
        mutate in interface org.apache.hadoop.hbase.client.BufferedMutator
        Parameters:
        ms - The data to send.
        Throws:
        IOException - if a remote or network exception occurs.
      • close

        public void close()
                   throws IOException
        Performs a flush() and releases any resources held.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface org.apache.hadoop.hbase.client.BufferedMutator
        Specified by:
        close in interface Closeable
        Throws:
        IOException - if a remote or network exception occurs.
      • flush

        public void flush()
                   throws IOException
        Executes all the buffered, asynchronous Mutation operations and waits until they are done.
        Specified by:
        flush in interface org.apache.hadoop.hbase.client.BufferedMutator
        Throws:
        IOException - if a remote or network exception occurs.
      • getWriteBufferSize

        public long getWriteBufferSize()
        Returns the maximum size in bytes of the write buffer for this HTable.

        The default value comes from the configuration parameter hbase.client.write.buffer.

        Specified by:
        getWriteBufferSize in interface org.apache.hadoop.hbase.client.BufferedMutator
        Returns:
        The size of the write buffer in bytes.
      • setRpcTimeout

        public void setRpcTimeout​(int timeout)
        Specified by:
        setRpcTimeout in interface org.apache.hadoop.hbase.client.BufferedMutator
      • setOperationTimeout

        public void setOperationTimeout​(int timeout)
        Specified by:
        setOperationTimeout in interface org.apache.hadoop.hbase.client.BufferedMutator