hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject [39/52] [partial] hbase-site git commit: Published site at 30d7eeaefe431bc263519064662e6dc8ad8ff05a.
Date Mon, 08 Aug 2016 14:22:35 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a5d8deaf/apidocs/src-html/org/apache/hadoop/hbase/RegionLoad.html
----------------------------------------------------------------------
diff --git a/apidocs/src-html/org/apache/hadoop/hbase/RegionLoad.html b/apidocs/src-html/org/apache/hadoop/hbase/RegionLoad.html
index 8176664..f3bebea 100644
--- a/apidocs/src-html/org/apache/hadoop/hbase/RegionLoad.html
+++ b/apidocs/src-html/org/apache/hadoop/hbase/RegionLoad.html
@@ -62,7 +62,7 @@
 <span class="sourceLineNo">054</span>   * @return the region name as a string<a name="line.54"></a>
 <span class="sourceLineNo">055</span>   */<a name="line.55"></a>
 <span class="sourceLineNo">056</span>  public String getNameAsString() {<a name="line.56"></a>
-<span class="sourceLineNo">057</span>    return Bytes.toString(getName());<a name="line.57"></a>
+<span class="sourceLineNo">057</span>    return Bytes.toStringBinary(getName());<a name="line.57"></a>
 <span class="sourceLineNo">058</span>  }<a name="line.58"></a>
 <span class="sourceLineNo">059</span><a name="line.59"></a>
 <span class="sourceLineNo">060</span>  /**<a name="line.60"></a>

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a5d8deaf/apidocs/src-html/org/apache/hadoop/hbase/client/HTableMultiplexer.HTableMultiplexerStatus.html
----------------------------------------------------------------------
diff --git a/apidocs/src-html/org/apache/hadoop/hbase/client/HTableMultiplexer.HTableMultiplexerStatus.html b/apidocs/src-html/org/apache/hadoop/hbase/client/HTableMultiplexer.HTableMultiplexerStatus.html
index 195ffb2..d607296 100644
--- a/apidocs/src-html/org/apache/hadoop/hbase/client/HTableMultiplexer.HTableMultiplexerStatus.html
+++ b/apidocs/src-html/org/apache/hadoop/hbase/client/HTableMultiplexer.HTableMultiplexerStatus.html
@@ -450,219 +450,223 @@
 <span class="sourceLineNo">442</span>    private final ScheduledExecutorService executor;<a name="line.442"></a>
 <span class="sourceLineNo">443</span>    private final int maxRetryInQueue;<a name="line.443"></a>
 <span class="sourceLineNo">444</span>    private final AtomicInteger retryInQueue = new AtomicInteger(0);<a name="line.444"></a>
-<span class="sourceLineNo">445</span><a name="line.445"></a>
-<span class="sourceLineNo">446</span>    public FlushWorker(Configuration conf, ClusterConnection conn, HRegionLocation addr,<a name="line.446"></a>
-<span class="sourceLineNo">447</span>        HTableMultiplexer htableMultiplexer, int perRegionServerBufferQueueSize,<a name="line.447"></a>
-<span class="sourceLineNo">448</span>        ExecutorService pool, ScheduledExecutorService executor) {<a name="line.448"></a>
-<span class="sourceLineNo">449</span>      this.addr = addr;<a name="line.449"></a>
-<span class="sourceLineNo">450</span>      this.multiplexer = htableMultiplexer;<a name="line.450"></a>
-<span class="sourceLineNo">451</span>      this.queue = new LinkedBlockingQueue&lt;&gt;(perRegionServerBufferQueueSize);<a name="line.451"></a>
-<span class="sourceLineNo">452</span>      RpcRetryingCallerFactory rpcCallerFactory = RpcRetryingCallerFactory.instantiate(conf);<a name="line.452"></a>
-<span class="sourceLineNo">453</span>      RpcControllerFactory rpcControllerFactory = RpcControllerFactory.instantiate(conf);<a name="line.453"></a>
-<span class="sourceLineNo">454</span>      this.ap = new AsyncProcess(conn, conf, pool, rpcCallerFactory, false, rpcControllerFactory);<a name="line.454"></a>
-<span class="sourceLineNo">455</span>      this.executor = executor;<a name="line.455"></a>
-<span class="sourceLineNo">456</span>      this.maxRetryInQueue = conf.getInt(TABLE_MULTIPLEXER_MAX_RETRIES_IN_QUEUE, 10000);<a name="line.456"></a>
-<span class="sourceLineNo">457</span>    }<a name="line.457"></a>
-<span class="sourceLineNo">458</span><a name="line.458"></a>
-<span class="sourceLineNo">459</span>    protected LinkedBlockingQueue&lt;PutStatus&gt; getQueue() {<a name="line.459"></a>
-<span class="sourceLineNo">460</span>      return this.queue;<a name="line.460"></a>
+<span class="sourceLineNo">445</span>    private final int writeRpcTimeout; // needed to pass in through AsyncProcess constructor<a name="line.445"></a>
+<span class="sourceLineNo">446</span><a name="line.446"></a>
+<span class="sourceLineNo">447</span>    public FlushWorker(Configuration conf, ClusterConnection conn, HRegionLocation addr,<a name="line.447"></a>
+<span class="sourceLineNo">448</span>        HTableMultiplexer htableMultiplexer, int perRegionServerBufferQueueSize,<a name="line.448"></a>
+<span class="sourceLineNo">449</span>        ExecutorService pool, ScheduledExecutorService executor) {<a name="line.449"></a>
+<span class="sourceLineNo">450</span>      this.addr = addr;<a name="line.450"></a>
+<span class="sourceLineNo">451</span>      this.multiplexer = htableMultiplexer;<a name="line.451"></a>
+<span class="sourceLineNo">452</span>      this.queue = new LinkedBlockingQueue&lt;&gt;(perRegionServerBufferQueueSize);<a name="line.452"></a>
+<span class="sourceLineNo">453</span>      RpcRetryingCallerFactory rpcCallerFactory = RpcRetryingCallerFactory.instantiate(conf);<a name="line.453"></a>
+<span class="sourceLineNo">454</span>      RpcControllerFactory rpcControllerFactory = RpcControllerFactory.instantiate(conf);<a name="line.454"></a>
+<span class="sourceLineNo">455</span>      this.writeRpcTimeout = conf.getInt(HConstants.HBASE_RPC_WRITE_TIMEOUT_KEY,<a name="line.455"></a>
+<span class="sourceLineNo">456</span>          conf.getInt(HConstants.HBASE_RPC_TIMEOUT_KEY,<a name="line.456"></a>
+<span class="sourceLineNo">457</span>              HConstants.DEFAULT_HBASE_RPC_TIMEOUT));<a name="line.457"></a>
+<span class="sourceLineNo">458</span>      this.ap = new AsyncProcess(conn, conf, pool, rpcCallerFactory, false, rpcControllerFactory, writeRpcTimeout);<a name="line.458"></a>
+<span class="sourceLineNo">459</span>      this.executor = executor;<a name="line.459"></a>
+<span class="sourceLineNo">460</span>      this.maxRetryInQueue = conf.getInt(TABLE_MULTIPLEXER_MAX_RETRIES_IN_QUEUE, 10000);<a name="line.460"></a>
 <span class="sourceLineNo">461</span>    }<a name="line.461"></a>
 <span class="sourceLineNo">462</span><a name="line.462"></a>
-<span class="sourceLineNo">463</span>    public long getTotalFailedCount() {<a name="line.463"></a>
-<span class="sourceLineNo">464</span>      return totalFailedPutCount.get();<a name="line.464"></a>
+<span class="sourceLineNo">463</span>    protected LinkedBlockingQueue&lt;PutStatus&gt; getQueue() {<a name="line.463"></a>
+<span class="sourceLineNo">464</span>      return this.queue;<a name="line.464"></a>
 <span class="sourceLineNo">465</span>    }<a name="line.465"></a>
 <span class="sourceLineNo">466</span><a name="line.466"></a>
-<span class="sourceLineNo">467</span>    public long getTotalBufferedCount() {<a name="line.467"></a>
-<span class="sourceLineNo">468</span>      return queue.size() + currentProcessingCount.get();<a name="line.468"></a>
+<span class="sourceLineNo">467</span>    public long getTotalFailedCount() {<a name="line.467"></a>
+<span class="sourceLineNo">468</span>      return totalFailedPutCount.get();<a name="line.468"></a>
 <span class="sourceLineNo">469</span>    }<a name="line.469"></a>
 <span class="sourceLineNo">470</span><a name="line.470"></a>
-<span class="sourceLineNo">471</span>    public AtomicAverageCounter getAverageLatencyCounter() {<a name="line.471"></a>
-<span class="sourceLineNo">472</span>      return this.averageLatency;<a name="line.472"></a>
+<span class="sourceLineNo">471</span>    public long getTotalBufferedCount() {<a name="line.471"></a>
+<span class="sourceLineNo">472</span>      return queue.size() + currentProcessingCount.get();<a name="line.472"></a>
 <span class="sourceLineNo">473</span>    }<a name="line.473"></a>
 <span class="sourceLineNo">474</span><a name="line.474"></a>
-<span class="sourceLineNo">475</span>    public long getMaxLatency() {<a name="line.475"></a>
-<span class="sourceLineNo">476</span>      return this.maxLatency.getAndSet(0);<a name="line.476"></a>
+<span class="sourceLineNo">475</span>    public AtomicAverageCounter getAverageLatencyCounter() {<a name="line.475"></a>
+<span class="sourceLineNo">476</span>      return this.averageLatency;<a name="line.476"></a>
 <span class="sourceLineNo">477</span>    }<a name="line.477"></a>
 <span class="sourceLineNo">478</span><a name="line.478"></a>
-<span class="sourceLineNo">479</span>    boolean resubmitFailedPut(PutStatus ps, HRegionLocation oldLoc) throws IOException {<a name="line.479"></a>
-<span class="sourceLineNo">480</span>      // Decrease the retry count<a name="line.480"></a>
-<span class="sourceLineNo">481</span>      final int retryCount = ps.maxAttempCount - 1;<a name="line.481"></a>
+<span class="sourceLineNo">479</span>    public long getMaxLatency() {<a name="line.479"></a>
+<span class="sourceLineNo">480</span>      return this.maxLatency.getAndSet(0);<a name="line.480"></a>
+<span class="sourceLineNo">481</span>    }<a name="line.481"></a>
 <span class="sourceLineNo">482</span><a name="line.482"></a>
-<span class="sourceLineNo">483</span>      if (retryCount &lt;= 0) {<a name="line.483"></a>
-<span class="sourceLineNo">484</span>        // Update the failed counter and no retry any more.<a name="line.484"></a>
-<span class="sourceLineNo">485</span>        return false;<a name="line.485"></a>
-<span class="sourceLineNo">486</span>      }<a name="line.486"></a>
-<span class="sourceLineNo">487</span><a name="line.487"></a>
-<span class="sourceLineNo">488</span>      int cnt = getRetryInQueue().incrementAndGet();<a name="line.488"></a>
-<span class="sourceLineNo">489</span>      if (cnt &gt; getMaxRetryInQueue()) {<a name="line.489"></a>
-<span class="sourceLineNo">490</span>        // Too many Puts in queue for resubmit, give up this<a name="line.490"></a>
-<span class="sourceLineNo">491</span>        getRetryInQueue().decrementAndGet();<a name="line.491"></a>
-<span class="sourceLineNo">492</span>        return false;<a name="line.492"></a>
-<span class="sourceLineNo">493</span>      }<a name="line.493"></a>
-<span class="sourceLineNo">494</span><a name="line.494"></a>
-<span class="sourceLineNo">495</span>      final Put failedPut = ps.put;<a name="line.495"></a>
-<span class="sourceLineNo">496</span>      // The currentPut is failed. So get the table name for the currentPut.<a name="line.496"></a>
-<span class="sourceLineNo">497</span>      final TableName tableName = ps.regionInfo.getTable();<a name="line.497"></a>
+<span class="sourceLineNo">483</span>    boolean resubmitFailedPut(PutStatus ps, HRegionLocation oldLoc) throws IOException {<a name="line.483"></a>
+<span class="sourceLineNo">484</span>      // Decrease the retry count<a name="line.484"></a>
+<span class="sourceLineNo">485</span>      final int retryCount = ps.maxAttempCount - 1;<a name="line.485"></a>
+<span class="sourceLineNo">486</span><a name="line.486"></a>
+<span class="sourceLineNo">487</span>      if (retryCount &lt;= 0) {<a name="line.487"></a>
+<span class="sourceLineNo">488</span>        // Update the failed counter and no retry any more.<a name="line.488"></a>
+<span class="sourceLineNo">489</span>        return false;<a name="line.489"></a>
+<span class="sourceLineNo">490</span>      }<a name="line.490"></a>
+<span class="sourceLineNo">491</span><a name="line.491"></a>
+<span class="sourceLineNo">492</span>      int cnt = getRetryInQueue().incrementAndGet();<a name="line.492"></a>
+<span class="sourceLineNo">493</span>      if (cnt &gt; getMaxRetryInQueue()) {<a name="line.493"></a>
+<span class="sourceLineNo">494</span>        // Too many Puts in queue for resubmit, give up this<a name="line.494"></a>
+<span class="sourceLineNo">495</span>        getRetryInQueue().decrementAndGet();<a name="line.495"></a>
+<span class="sourceLineNo">496</span>        return false;<a name="line.496"></a>
+<span class="sourceLineNo">497</span>      }<a name="line.497"></a>
 <span class="sourceLineNo">498</span><a name="line.498"></a>
-<span class="sourceLineNo">499</span>      long delayMs = getNextDelay(retryCount);<a name="line.499"></a>
-<span class="sourceLineNo">500</span>      if (LOG.isDebugEnabled()) {<a name="line.500"></a>
-<span class="sourceLineNo">501</span>        LOG.debug("resubmitting after " + delayMs + "ms: " + retryCount);<a name="line.501"></a>
-<span class="sourceLineNo">502</span>      }<a name="line.502"></a>
-<span class="sourceLineNo">503</span><a name="line.503"></a>
-<span class="sourceLineNo">504</span>      // HBASE-12198, HBASE-15221, HBASE-15232: AsyncProcess should be responsible for updating<a name="line.504"></a>
-<span class="sourceLineNo">505</span>      // the region location cache when the Put original failed with some exception. If we keep<a name="line.505"></a>
-<span class="sourceLineNo">506</span>      // re-trying the same Put to the same location, AsyncProcess isn't doing the right stuff<a name="line.506"></a>
-<span class="sourceLineNo">507</span>      // that we expect it to.<a name="line.507"></a>
-<span class="sourceLineNo">508</span>      getExecutor().schedule(new Runnable() {<a name="line.508"></a>
-<span class="sourceLineNo">509</span>        @Override<a name="line.509"></a>
-<span class="sourceLineNo">510</span>        public void run() {<a name="line.510"></a>
-<span class="sourceLineNo">511</span>          boolean succ = false;<a name="line.511"></a>
-<span class="sourceLineNo">512</span>          try {<a name="line.512"></a>
-<span class="sourceLineNo">513</span>            succ = FlushWorker.this.getMultiplexer().put(tableName, failedPut, retryCount);<a name="line.513"></a>
-<span class="sourceLineNo">514</span>          } finally {<a name="line.514"></a>
-<span class="sourceLineNo">515</span>            FlushWorker.this.getRetryInQueue().decrementAndGet();<a name="line.515"></a>
-<span class="sourceLineNo">516</span>            if (!succ) {<a name="line.516"></a>
-<span class="sourceLineNo">517</span>              FlushWorker.this.getTotalFailedPutCount().incrementAndGet();<a name="line.517"></a>
-<span class="sourceLineNo">518</span>            }<a name="line.518"></a>
-<span class="sourceLineNo">519</span>          }<a name="line.519"></a>
-<span class="sourceLineNo">520</span>        }<a name="line.520"></a>
-<span class="sourceLineNo">521</span>      }, delayMs, TimeUnit.MILLISECONDS);<a name="line.521"></a>
-<span class="sourceLineNo">522</span>      return true;<a name="line.522"></a>
-<span class="sourceLineNo">523</span>    }<a name="line.523"></a>
-<span class="sourceLineNo">524</span><a name="line.524"></a>
-<span class="sourceLineNo">525</span>    @VisibleForTesting<a name="line.525"></a>
-<span class="sourceLineNo">526</span>    long getNextDelay(int retryCount) {<a name="line.526"></a>
-<span class="sourceLineNo">527</span>      return ConnectionUtils.getPauseTime(multiplexer.flushPeriod,<a name="line.527"></a>
-<span class="sourceLineNo">528</span>          multiplexer.maxAttempts - retryCount - 1);<a name="line.528"></a>
-<span class="sourceLineNo">529</span>    }<a name="line.529"></a>
-<span class="sourceLineNo">530</span><a name="line.530"></a>
-<span class="sourceLineNo">531</span>    @VisibleForTesting<a name="line.531"></a>
-<span class="sourceLineNo">532</span>    AtomicInteger getRetryInQueue() {<a name="line.532"></a>
-<span class="sourceLineNo">533</span>      return this.retryInQueue;<a name="line.533"></a>
-<span class="sourceLineNo">534</span>    }<a name="line.534"></a>
-<span class="sourceLineNo">535</span><a name="line.535"></a>
-<span class="sourceLineNo">536</span>    @VisibleForTesting<a name="line.536"></a>
-<span class="sourceLineNo">537</span>    int getMaxRetryInQueue() {<a name="line.537"></a>
-<span class="sourceLineNo">538</span>      return this.maxRetryInQueue;<a name="line.538"></a>
-<span class="sourceLineNo">539</span>    }<a name="line.539"></a>
-<span class="sourceLineNo">540</span><a name="line.540"></a>
-<span class="sourceLineNo">541</span>    @VisibleForTesting<a name="line.541"></a>
-<span class="sourceLineNo">542</span>    AtomicLong getTotalFailedPutCount() {<a name="line.542"></a>
-<span class="sourceLineNo">543</span>      return this.totalFailedPutCount;<a name="line.543"></a>
-<span class="sourceLineNo">544</span>    }<a name="line.544"></a>
-<span class="sourceLineNo">545</span><a name="line.545"></a>
-<span class="sourceLineNo">546</span>    @VisibleForTesting<a name="line.546"></a>
-<span class="sourceLineNo">547</span>    HTableMultiplexer getMultiplexer() {<a name="line.547"></a>
-<span class="sourceLineNo">548</span>      return this.multiplexer;<a name="line.548"></a>
-<span class="sourceLineNo">549</span>    }<a name="line.549"></a>
-<span class="sourceLineNo">550</span><a name="line.550"></a>
-<span class="sourceLineNo">551</span>    @VisibleForTesting<a name="line.551"></a>
-<span class="sourceLineNo">552</span>    ScheduledExecutorService getExecutor() {<a name="line.552"></a>
-<span class="sourceLineNo">553</span>      return this.executor;<a name="line.553"></a>
-<span class="sourceLineNo">554</span>    }<a name="line.554"></a>
-<span class="sourceLineNo">555</span><a name="line.555"></a>
-<span class="sourceLineNo">556</span>    @Override<a name="line.556"></a>
-<span class="sourceLineNo">557</span>    public void run() {<a name="line.557"></a>
-<span class="sourceLineNo">558</span>      int failedCount = 0;<a name="line.558"></a>
-<span class="sourceLineNo">559</span>      try {<a name="line.559"></a>
-<span class="sourceLineNo">560</span>        long start = EnvironmentEdgeManager.currentTime();<a name="line.560"></a>
-<span class="sourceLineNo">561</span><a name="line.561"></a>
-<span class="sourceLineNo">562</span>        // drain all the queued puts into the tmp list<a name="line.562"></a>
-<span class="sourceLineNo">563</span>        processingList.clear();<a name="line.563"></a>
-<span class="sourceLineNo">564</span>        queue.drainTo(processingList);<a name="line.564"></a>
-<span class="sourceLineNo">565</span>        if (processingList.size() == 0) {<a name="line.565"></a>
-<span class="sourceLineNo">566</span>          // Nothing to flush<a name="line.566"></a>
-<span class="sourceLineNo">567</span>          return;<a name="line.567"></a>
-<span class="sourceLineNo">568</span>        }<a name="line.568"></a>
-<span class="sourceLineNo">569</span><a name="line.569"></a>
-<span class="sourceLineNo">570</span>        currentProcessingCount.set(processingList.size());<a name="line.570"></a>
-<span class="sourceLineNo">571</span>        // failedCount is decreased whenever a Put is success or resubmit.<a name="line.571"></a>
-<span class="sourceLineNo">572</span>        failedCount = processingList.size();<a name="line.572"></a>
+<span class="sourceLineNo">499</span>      final Put failedPut = ps.put;<a name="line.499"></a>
+<span class="sourceLineNo">500</span>      // The currentPut is failed. So get the table name for the currentPut.<a name="line.500"></a>
+<span class="sourceLineNo">501</span>      final TableName tableName = ps.regionInfo.getTable();<a name="line.501"></a>
+<span class="sourceLineNo">502</span><a name="line.502"></a>
+<span class="sourceLineNo">503</span>      long delayMs = getNextDelay(retryCount);<a name="line.503"></a>
+<span class="sourceLineNo">504</span>      if (LOG.isDebugEnabled()) {<a name="line.504"></a>
+<span class="sourceLineNo">505</span>        LOG.debug("resubmitting after " + delayMs + "ms: " + retryCount);<a name="line.505"></a>
+<span class="sourceLineNo">506</span>      }<a name="line.506"></a>
+<span class="sourceLineNo">507</span><a name="line.507"></a>
+<span class="sourceLineNo">508</span>      // HBASE-12198, HBASE-15221, HBASE-15232: AsyncProcess should be responsible for updating<a name="line.508"></a>
+<span class="sourceLineNo">509</span>      // the region location cache when the Put original failed with some exception. If we keep<a name="line.509"></a>
+<span class="sourceLineNo">510</span>      // re-trying the same Put to the same location, AsyncProcess isn't doing the right stuff<a name="line.510"></a>
+<span class="sourceLineNo">511</span>      // that we expect it to.<a name="line.511"></a>
+<span class="sourceLineNo">512</span>      getExecutor().schedule(new Runnable() {<a name="line.512"></a>
+<span class="sourceLineNo">513</span>        @Override<a name="line.513"></a>
+<span class="sourceLineNo">514</span>        public void run() {<a name="line.514"></a>
+<span class="sourceLineNo">515</span>          boolean succ = false;<a name="line.515"></a>
+<span class="sourceLineNo">516</span>          try {<a name="line.516"></a>
+<span class="sourceLineNo">517</span>            succ = FlushWorker.this.getMultiplexer().put(tableName, failedPut, retryCount);<a name="line.517"></a>
+<span class="sourceLineNo">518</span>          } finally {<a name="line.518"></a>
+<span class="sourceLineNo">519</span>            FlushWorker.this.getRetryInQueue().decrementAndGet();<a name="line.519"></a>
+<span class="sourceLineNo">520</span>            if (!succ) {<a name="line.520"></a>
+<span class="sourceLineNo">521</span>              FlushWorker.this.getTotalFailedPutCount().incrementAndGet();<a name="line.521"></a>
+<span class="sourceLineNo">522</span>            }<a name="line.522"></a>
+<span class="sourceLineNo">523</span>          }<a name="line.523"></a>
+<span class="sourceLineNo">524</span>        }<a name="line.524"></a>
+<span class="sourceLineNo">525</span>      }, delayMs, TimeUnit.MILLISECONDS);<a name="line.525"></a>
+<span class="sourceLineNo">526</span>      return true;<a name="line.526"></a>
+<span class="sourceLineNo">527</span>    }<a name="line.527"></a>
+<span class="sourceLineNo">528</span><a name="line.528"></a>
+<span class="sourceLineNo">529</span>    @VisibleForTesting<a name="line.529"></a>
+<span class="sourceLineNo">530</span>    long getNextDelay(int retryCount) {<a name="line.530"></a>
+<span class="sourceLineNo">531</span>      return ConnectionUtils.getPauseTime(multiplexer.flushPeriod,<a name="line.531"></a>
+<span class="sourceLineNo">532</span>          multiplexer.maxAttempts - retryCount - 1);<a name="line.532"></a>
+<span class="sourceLineNo">533</span>    }<a name="line.533"></a>
+<span class="sourceLineNo">534</span><a name="line.534"></a>
+<span class="sourceLineNo">535</span>    @VisibleForTesting<a name="line.535"></a>
+<span class="sourceLineNo">536</span>    AtomicInteger getRetryInQueue() {<a name="line.536"></a>
+<span class="sourceLineNo">537</span>      return this.retryInQueue;<a name="line.537"></a>
+<span class="sourceLineNo">538</span>    }<a name="line.538"></a>
+<span class="sourceLineNo">539</span><a name="line.539"></a>
+<span class="sourceLineNo">540</span>    @VisibleForTesting<a name="line.540"></a>
+<span class="sourceLineNo">541</span>    int getMaxRetryInQueue() {<a name="line.541"></a>
+<span class="sourceLineNo">542</span>      return this.maxRetryInQueue;<a name="line.542"></a>
+<span class="sourceLineNo">543</span>    }<a name="line.543"></a>
+<span class="sourceLineNo">544</span><a name="line.544"></a>
+<span class="sourceLineNo">545</span>    @VisibleForTesting<a name="line.545"></a>
+<span class="sourceLineNo">546</span>    AtomicLong getTotalFailedPutCount() {<a name="line.546"></a>
+<span class="sourceLineNo">547</span>      return this.totalFailedPutCount;<a name="line.547"></a>
+<span class="sourceLineNo">548</span>    }<a name="line.548"></a>
+<span class="sourceLineNo">549</span><a name="line.549"></a>
+<span class="sourceLineNo">550</span>    @VisibleForTesting<a name="line.550"></a>
+<span class="sourceLineNo">551</span>    HTableMultiplexer getMultiplexer() {<a name="line.551"></a>
+<span class="sourceLineNo">552</span>      return this.multiplexer;<a name="line.552"></a>
+<span class="sourceLineNo">553</span>    }<a name="line.553"></a>
+<span class="sourceLineNo">554</span><a name="line.554"></a>
+<span class="sourceLineNo">555</span>    @VisibleForTesting<a name="line.555"></a>
+<span class="sourceLineNo">556</span>    ScheduledExecutorService getExecutor() {<a name="line.556"></a>
+<span class="sourceLineNo">557</span>      return this.executor;<a name="line.557"></a>
+<span class="sourceLineNo">558</span>    }<a name="line.558"></a>
+<span class="sourceLineNo">559</span><a name="line.559"></a>
+<span class="sourceLineNo">560</span>    @Override<a name="line.560"></a>
+<span class="sourceLineNo">561</span>    public void run() {<a name="line.561"></a>
+<span class="sourceLineNo">562</span>      int failedCount = 0;<a name="line.562"></a>
+<span class="sourceLineNo">563</span>      try {<a name="line.563"></a>
+<span class="sourceLineNo">564</span>        long start = EnvironmentEdgeManager.currentTime();<a name="line.564"></a>
+<span class="sourceLineNo">565</span><a name="line.565"></a>
+<span class="sourceLineNo">566</span>        // drain all the queued puts into the tmp list<a name="line.566"></a>
+<span class="sourceLineNo">567</span>        processingList.clear();<a name="line.567"></a>
+<span class="sourceLineNo">568</span>        queue.drainTo(processingList);<a name="line.568"></a>
+<span class="sourceLineNo">569</span>        if (processingList.size() == 0) {<a name="line.569"></a>
+<span class="sourceLineNo">570</span>          // Nothing to flush<a name="line.570"></a>
+<span class="sourceLineNo">571</span>          return;<a name="line.571"></a>
+<span class="sourceLineNo">572</span>        }<a name="line.572"></a>
 <span class="sourceLineNo">573</span><a name="line.573"></a>
-<span class="sourceLineNo">574</span>        List&lt;Action&lt;Row&gt;&gt; retainedActions = new ArrayList&lt;&gt;(processingList.size());<a name="line.574"></a>
-<span class="sourceLineNo">575</span>        MultiAction&lt;Row&gt; actions = new MultiAction&lt;&gt;();<a name="line.575"></a>
-<span class="sourceLineNo">576</span>        for (int i = 0; i &lt; processingList.size(); i++) {<a name="line.576"></a>
-<span class="sourceLineNo">577</span>          PutStatus putStatus = processingList.get(i);<a name="line.577"></a>
-<span class="sourceLineNo">578</span>          Action&lt;Row&gt; action = new Action&lt;Row&gt;(putStatus.put, i);<a name="line.578"></a>
-<span class="sourceLineNo">579</span>          actions.add(putStatus.regionInfo.getRegionName(), action);<a name="line.579"></a>
-<span class="sourceLineNo">580</span>          retainedActions.add(action);<a name="line.580"></a>
-<span class="sourceLineNo">581</span>        }<a name="line.581"></a>
-<span class="sourceLineNo">582</span><a name="line.582"></a>
-<span class="sourceLineNo">583</span>        // Process this multi-put request<a name="line.583"></a>
-<span class="sourceLineNo">584</span>        List&lt;PutStatus&gt; failed = null;<a name="line.584"></a>
-<span class="sourceLineNo">585</span>        Object[] results = new Object[actions.size()];<a name="line.585"></a>
-<span class="sourceLineNo">586</span>        ServerName server = addr.getServerName();<a name="line.586"></a>
-<span class="sourceLineNo">587</span>        Map&lt;ServerName, MultiAction&lt;Row&gt;&gt; actionsByServer =<a name="line.587"></a>
-<span class="sourceLineNo">588</span>            Collections.singletonMap(server, actions);<a name="line.588"></a>
-<span class="sourceLineNo">589</span>        try {<a name="line.589"></a>
-<span class="sourceLineNo">590</span>          AsyncRequestFuture arf =<a name="line.590"></a>
-<span class="sourceLineNo">591</span>              ap.submitMultiActions(null, retainedActions, 0L, null, results, true, null,<a name="line.591"></a>
-<span class="sourceLineNo">592</span>                null, actionsByServer, null);<a name="line.592"></a>
-<span class="sourceLineNo">593</span>          arf.waitUntilDone();<a name="line.593"></a>
-<span class="sourceLineNo">594</span>          if (arf.hasError()) {<a name="line.594"></a>
-<span class="sourceLineNo">595</span>            // We just log and ignore the exception here since failed Puts will be resubmit again.<a name="line.595"></a>
-<span class="sourceLineNo">596</span>            LOG.debug("Caught some exceptions when flushing puts to region server "<a name="line.596"></a>
-<span class="sourceLineNo">597</span>                + addr.getHostnamePort(), arf.getErrors());<a name="line.597"></a>
-<span class="sourceLineNo">598</span>          }<a name="line.598"></a>
-<span class="sourceLineNo">599</span>        } finally {<a name="line.599"></a>
-<span class="sourceLineNo">600</span>          for (int i = 0; i &lt; results.length; i++) {<a name="line.600"></a>
-<span class="sourceLineNo">601</span>            if (results[i] instanceof Result) {<a name="line.601"></a>
-<span class="sourceLineNo">602</span>              failedCount--;<a name="line.602"></a>
-<span class="sourceLineNo">603</span>            } else {<a name="line.603"></a>
-<span class="sourceLineNo">604</span>              if (failed == null) {<a name="line.604"></a>
-<span class="sourceLineNo">605</span>                failed = new ArrayList&lt;PutStatus&gt;();<a name="line.605"></a>
-<span class="sourceLineNo">606</span>              }<a name="line.606"></a>
-<span class="sourceLineNo">607</span>              failed.add(processingList.get(i));<a name="line.607"></a>
-<span class="sourceLineNo">608</span>            }<a name="line.608"></a>
-<span class="sourceLineNo">609</span>          }<a name="line.609"></a>
-<span class="sourceLineNo">610</span>        }<a name="line.610"></a>
-<span class="sourceLineNo">611</span><a name="line.611"></a>
-<span class="sourceLineNo">612</span>        if (failed != null) {<a name="line.612"></a>
-<span class="sourceLineNo">613</span>          // Resubmit failed puts<a name="line.613"></a>
-<span class="sourceLineNo">614</span>          for (PutStatus putStatus : failed) {<a name="line.614"></a>
-<span class="sourceLineNo">615</span>            if (resubmitFailedPut(putStatus, this.addr)) {<a name="line.615"></a>
-<span class="sourceLineNo">616</span>              failedCount--;<a name="line.616"></a>
-<span class="sourceLineNo">617</span>            }<a name="line.617"></a>
-<span class="sourceLineNo">618</span>          }<a name="line.618"></a>
-<span class="sourceLineNo">619</span>        }<a name="line.619"></a>
-<span class="sourceLineNo">620</span><a name="line.620"></a>
-<span class="sourceLineNo">621</span>        long elapsed = EnvironmentEdgeManager.currentTime() - start;<a name="line.621"></a>
-<span class="sourceLineNo">622</span>        // Update latency counters<a name="line.622"></a>
-<span class="sourceLineNo">623</span>        averageLatency.add(elapsed);<a name="line.623"></a>
-<span class="sourceLineNo">624</span>        if (elapsed &gt; maxLatency.get()) {<a name="line.624"></a>
-<span class="sourceLineNo">625</span>          maxLatency.set(elapsed);<a name="line.625"></a>
-<span class="sourceLineNo">626</span>        }<a name="line.626"></a>
-<span class="sourceLineNo">627</span><a name="line.627"></a>
-<span class="sourceLineNo">628</span>        // Log some basic info<a name="line.628"></a>
-<span class="sourceLineNo">629</span>        if (LOG.isDebugEnabled()) {<a name="line.629"></a>
-<span class="sourceLineNo">630</span>          LOG.debug("Processed " + currentProcessingCount + " put requests for "<a name="line.630"></a>
-<span class="sourceLineNo">631</span>              + addr.getHostnamePort() + " and " + failedCount + " failed"<a name="line.631"></a>
-<span class="sourceLineNo">632</span>              + ", latency for this send: " + elapsed);<a name="line.632"></a>
-<span class="sourceLineNo">633</span>        }<a name="line.633"></a>
-<span class="sourceLineNo">634</span><a name="line.634"></a>
-<span class="sourceLineNo">635</span>        // Reset the current processing put count<a name="line.635"></a>
-<span class="sourceLineNo">636</span>        currentProcessingCount.set(0);<a name="line.636"></a>
-<span class="sourceLineNo">637</span>      } catch (RuntimeException e) {<a name="line.637"></a>
-<span class="sourceLineNo">638</span>        // To make findbugs happy<a name="line.638"></a>
-<span class="sourceLineNo">639</span>        // Log all the exceptions and move on<a name="line.639"></a>
-<span class="sourceLineNo">640</span>        LOG.debug(<a name="line.640"></a>
-<span class="sourceLineNo">641</span>          "Caught some exceptions " + e + " when flushing puts to region server "<a name="line.641"></a>
-<span class="sourceLineNo">642</span>              + addr.getHostnamePort(), e);<a name="line.642"></a>
-<span class="sourceLineNo">643</span>      } catch (Exception e) {<a name="line.643"></a>
-<span class="sourceLineNo">644</span>        if (e instanceof InterruptedException) {<a name="line.644"></a>
-<span class="sourceLineNo">645</span>          Thread.currentThread().interrupt();<a name="line.645"></a>
-<span class="sourceLineNo">646</span>        }<a name="line.646"></a>
-<span class="sourceLineNo">647</span>        // Log all the exceptions and move on<a name="line.647"></a>
-<span class="sourceLineNo">648</span>        LOG.debug(<a name="line.648"></a>
-<span class="sourceLineNo">649</span>          "Caught some exceptions " + e + " when flushing puts to region server "<a name="line.649"></a>
-<span class="sourceLineNo">650</span>              + addr.getHostnamePort(), e);<a name="line.650"></a>
-<span class="sourceLineNo">651</span>      } finally {<a name="line.651"></a>
-<span class="sourceLineNo">652</span>        // Update the totalFailedCount<a name="line.652"></a>
-<span class="sourceLineNo">653</span>        this.totalFailedPutCount.addAndGet(failedCount);<a name="line.653"></a>
-<span class="sourceLineNo">654</span>      }<a name="line.654"></a>
-<span class="sourceLineNo">655</span>    }<a name="line.655"></a>
-<span class="sourceLineNo">656</span>  }<a name="line.656"></a>
-<span class="sourceLineNo">657</span>}<a name="line.657"></a>
+<span class="sourceLineNo">574</span>        currentProcessingCount.set(processingList.size());<a name="line.574"></a>
+<span class="sourceLineNo">575</span>        // failedCount is decreased whenever a Put is success or resubmit.<a name="line.575"></a>
+<span class="sourceLineNo">576</span>        failedCount = processingList.size();<a name="line.576"></a>
+<span class="sourceLineNo">577</span><a name="line.577"></a>
+<span class="sourceLineNo">578</span>        List&lt;Action&lt;Row&gt;&gt; retainedActions = new ArrayList&lt;&gt;(processingList.size());<a name="line.578"></a>
+<span class="sourceLineNo">579</span>        MultiAction&lt;Row&gt; actions = new MultiAction&lt;&gt;();<a name="line.579"></a>
+<span class="sourceLineNo">580</span>        for (int i = 0; i &lt; processingList.size(); i++) {<a name="line.580"></a>
+<span class="sourceLineNo">581</span>          PutStatus putStatus = processingList.get(i);<a name="line.581"></a>
+<span class="sourceLineNo">582</span>          Action&lt;Row&gt; action = new Action&lt;Row&gt;(putStatus.put, i);<a name="line.582"></a>
+<span class="sourceLineNo">583</span>          actions.add(putStatus.regionInfo.getRegionName(), action);<a name="line.583"></a>
+<span class="sourceLineNo">584</span>          retainedActions.add(action);<a name="line.584"></a>
+<span class="sourceLineNo">585</span>        }<a name="line.585"></a>
+<span class="sourceLineNo">586</span><a name="line.586"></a>
+<span class="sourceLineNo">587</span>        // Process this multi-put request<a name="line.587"></a>
+<span class="sourceLineNo">588</span>        List&lt;PutStatus&gt; failed = null;<a name="line.588"></a>
+<span class="sourceLineNo">589</span>        Object[] results = new Object[actions.size()];<a name="line.589"></a>
+<span class="sourceLineNo">590</span>        ServerName server = addr.getServerName();<a name="line.590"></a>
+<span class="sourceLineNo">591</span>        Map&lt;ServerName, MultiAction&lt;Row&gt;&gt; actionsByServer =<a name="line.591"></a>
+<span class="sourceLineNo">592</span>            Collections.singletonMap(server, actions);<a name="line.592"></a>
+<span class="sourceLineNo">593</span>        try {<a name="line.593"></a>
+<span class="sourceLineNo">594</span>          AsyncRequestFuture arf =<a name="line.594"></a>
+<span class="sourceLineNo">595</span>              ap.submitMultiActions(null, retainedActions, 0L, null, results, true, null,<a name="line.595"></a>
+<span class="sourceLineNo">596</span>                null, actionsByServer, null);<a name="line.596"></a>
+<span class="sourceLineNo">597</span>          arf.waitUntilDone();<a name="line.597"></a>
+<span class="sourceLineNo">598</span>          if (arf.hasError()) {<a name="line.598"></a>
+<span class="sourceLineNo">599</span>            // We just log and ignore the exception here since failed Puts will be resubmit again.<a name="line.599"></a>
+<span class="sourceLineNo">600</span>            LOG.debug("Caught some exceptions when flushing puts to region server "<a name="line.600"></a>
+<span class="sourceLineNo">601</span>                + addr.getHostnamePort(), arf.getErrors());<a name="line.601"></a>
+<span class="sourceLineNo">602</span>          }<a name="line.602"></a>
+<span class="sourceLineNo">603</span>        } finally {<a name="line.603"></a>
+<span class="sourceLineNo">604</span>          for (int i = 0; i &lt; results.length; i++) {<a name="line.604"></a>
+<span class="sourceLineNo">605</span>            if (results[i] instanceof Result) {<a name="line.605"></a>
+<span class="sourceLineNo">606</span>              failedCount--;<a name="line.606"></a>
+<span class="sourceLineNo">607</span>            } else {<a name="line.607"></a>
+<span class="sourceLineNo">608</span>              if (failed == null) {<a name="line.608"></a>
+<span class="sourceLineNo">609</span>                failed = new ArrayList&lt;PutStatus&gt;();<a name="line.609"></a>
+<span class="sourceLineNo">610</span>              }<a name="line.610"></a>
+<span class="sourceLineNo">611</span>              failed.add(processingList.get(i));<a name="line.611"></a>
+<span class="sourceLineNo">612</span>            }<a name="line.612"></a>
+<span class="sourceLineNo">613</span>          }<a name="line.613"></a>
+<span class="sourceLineNo">614</span>        }<a name="line.614"></a>
+<span class="sourceLineNo">615</span><a name="line.615"></a>
+<span class="sourceLineNo">616</span>        if (failed != null) {<a name="line.616"></a>
+<span class="sourceLineNo">617</span>          // Resubmit failed puts<a name="line.617"></a>
+<span class="sourceLineNo">618</span>          for (PutStatus putStatus : failed) {<a name="line.618"></a>
+<span class="sourceLineNo">619</span>            if (resubmitFailedPut(putStatus, this.addr)) {<a name="line.619"></a>
+<span class="sourceLineNo">620</span>              failedCount--;<a name="line.620"></a>
+<span class="sourceLineNo">621</span>            }<a name="line.621"></a>
+<span class="sourceLineNo">622</span>          }<a name="line.622"></a>
+<span class="sourceLineNo">623</span>        }<a name="line.623"></a>
+<span class="sourceLineNo">624</span><a name="line.624"></a>
+<span class="sourceLineNo">625</span>        long elapsed = EnvironmentEdgeManager.currentTime() - start;<a name="line.625"></a>
+<span class="sourceLineNo">626</span>        // Update latency counters<a name="line.626"></a>
+<span class="sourceLineNo">627</span>        averageLatency.add(elapsed);<a name="line.627"></a>
+<span class="sourceLineNo">628</span>        if (elapsed &gt; maxLatency.get()) {<a name="line.628"></a>
+<span class="sourceLineNo">629</span>          maxLatency.set(elapsed);<a name="line.629"></a>
+<span class="sourceLineNo">630</span>        }<a name="line.630"></a>
+<span class="sourceLineNo">631</span><a name="line.631"></a>
+<span class="sourceLineNo">632</span>        // Log some basic info<a name="line.632"></a>
+<span class="sourceLineNo">633</span>        if (LOG.isDebugEnabled()) {<a name="line.633"></a>
+<span class="sourceLineNo">634</span>          LOG.debug("Processed " + currentProcessingCount + " put requests for "<a name="line.634"></a>
+<span class="sourceLineNo">635</span>              + addr.getHostnamePort() + " and " + failedCount + " failed"<a name="line.635"></a>
+<span class="sourceLineNo">636</span>              + ", latency for this send: " + elapsed);<a name="line.636"></a>
+<span class="sourceLineNo">637</span>        }<a name="line.637"></a>
+<span class="sourceLineNo">638</span><a name="line.638"></a>
+<span class="sourceLineNo">639</span>        // Reset the current processing put count<a name="line.639"></a>
+<span class="sourceLineNo">640</span>        currentProcessingCount.set(0);<a name="line.640"></a>
+<span class="sourceLineNo">641</span>      } catch (RuntimeException e) {<a name="line.641"></a>
+<span class="sourceLineNo">642</span>        // To make findbugs happy<a name="line.642"></a>
+<span class="sourceLineNo">643</span>        // Log all the exceptions and move on<a name="line.643"></a>
+<span class="sourceLineNo">644</span>        LOG.debug(<a name="line.644"></a>
+<span class="sourceLineNo">645</span>          "Caught some exceptions " + e + " when flushing puts to region server "<a name="line.645"></a>
+<span class="sourceLineNo">646</span>              + addr.getHostnamePort(), e);<a name="line.646"></a>
+<span class="sourceLineNo">647</span>      } catch (Exception e) {<a name="line.647"></a>
+<span class="sourceLineNo">648</span>        if (e instanceof InterruptedException) {<a name="line.648"></a>
+<span class="sourceLineNo">649</span>          Thread.currentThread().interrupt();<a name="line.649"></a>
+<span class="sourceLineNo">650</span>        }<a name="line.650"></a>
+<span class="sourceLineNo">651</span>        // Log all the exceptions and move on<a name="line.651"></a>
+<span class="sourceLineNo">652</span>        LOG.debug(<a name="line.652"></a>
+<span class="sourceLineNo">653</span>          "Caught some exceptions " + e + " when flushing puts to region server "<a name="line.653"></a>
+<span class="sourceLineNo">654</span>              + addr.getHostnamePort(), e);<a name="line.654"></a>
+<span class="sourceLineNo">655</span>      } finally {<a name="line.655"></a>
+<span class="sourceLineNo">656</span>        // Update the totalFailedCount<a name="line.656"></a>
+<span class="sourceLineNo">657</span>        this.totalFailedPutCount.addAndGet(failedCount);<a name="line.657"></a>
+<span class="sourceLineNo">658</span>      }<a name="line.658"></a>
+<span class="sourceLineNo">659</span>    }<a name="line.659"></a>
+<span class="sourceLineNo">660</span>  }<a name="line.660"></a>
+<span class="sourceLineNo">661</span>}<a name="line.661"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a5d8deaf/apidocs/src-html/org/apache/hadoop/hbase/client/HTableMultiplexer.html
----------------------------------------------------------------------
diff --git a/apidocs/src-html/org/apache/hadoop/hbase/client/HTableMultiplexer.html b/apidocs/src-html/org/apache/hadoop/hbase/client/HTableMultiplexer.html
index 195ffb2..d607296 100644
--- a/apidocs/src-html/org/apache/hadoop/hbase/client/HTableMultiplexer.html
+++ b/apidocs/src-html/org/apache/hadoop/hbase/client/HTableMultiplexer.html
@@ -450,219 +450,223 @@
 <span class="sourceLineNo">442</span>    private final ScheduledExecutorService executor;<a name="line.442"></a>
 <span class="sourceLineNo">443</span>    private final int maxRetryInQueue;<a name="line.443"></a>
 <span class="sourceLineNo">444</span>    private final AtomicInteger retryInQueue = new AtomicInteger(0);<a name="line.444"></a>
-<span class="sourceLineNo">445</span><a name="line.445"></a>
-<span class="sourceLineNo">446</span>    public FlushWorker(Configuration conf, ClusterConnection conn, HRegionLocation addr,<a name="line.446"></a>
-<span class="sourceLineNo">447</span>        HTableMultiplexer htableMultiplexer, int perRegionServerBufferQueueSize,<a name="line.447"></a>
-<span class="sourceLineNo">448</span>        ExecutorService pool, ScheduledExecutorService executor) {<a name="line.448"></a>
-<span class="sourceLineNo">449</span>      this.addr = addr;<a name="line.449"></a>
-<span class="sourceLineNo">450</span>      this.multiplexer = htableMultiplexer;<a name="line.450"></a>
-<span class="sourceLineNo">451</span>      this.queue = new LinkedBlockingQueue&lt;&gt;(perRegionServerBufferQueueSize);<a name="line.451"></a>
-<span class="sourceLineNo">452</span>      RpcRetryingCallerFactory rpcCallerFactory = RpcRetryingCallerFactory.instantiate(conf);<a name="line.452"></a>
-<span class="sourceLineNo">453</span>      RpcControllerFactory rpcControllerFactory = RpcControllerFactory.instantiate(conf);<a name="line.453"></a>
-<span class="sourceLineNo">454</span>      this.ap = new AsyncProcess(conn, conf, pool, rpcCallerFactory, false, rpcControllerFactory);<a name="line.454"></a>
-<span class="sourceLineNo">455</span>      this.executor = executor;<a name="line.455"></a>
-<span class="sourceLineNo">456</span>      this.maxRetryInQueue = conf.getInt(TABLE_MULTIPLEXER_MAX_RETRIES_IN_QUEUE, 10000);<a name="line.456"></a>
-<span class="sourceLineNo">457</span>    }<a name="line.457"></a>
-<span class="sourceLineNo">458</span><a name="line.458"></a>
-<span class="sourceLineNo">459</span>    protected LinkedBlockingQueue&lt;PutStatus&gt; getQueue() {<a name="line.459"></a>
-<span class="sourceLineNo">460</span>      return this.queue;<a name="line.460"></a>
+<span class="sourceLineNo">445</span>    private final int writeRpcTimeout; // needed to pass in through AsyncProcess constructor<a name="line.445"></a>
+<span class="sourceLineNo">446</span><a name="line.446"></a>
+<span class="sourceLineNo">447</span>    public FlushWorker(Configuration conf, ClusterConnection conn, HRegionLocation addr,<a name="line.447"></a>
+<span class="sourceLineNo">448</span>        HTableMultiplexer htableMultiplexer, int perRegionServerBufferQueueSize,<a name="line.448"></a>
+<span class="sourceLineNo">449</span>        ExecutorService pool, ScheduledExecutorService executor) {<a name="line.449"></a>
+<span class="sourceLineNo">450</span>      this.addr = addr;<a name="line.450"></a>
+<span class="sourceLineNo">451</span>      this.multiplexer = htableMultiplexer;<a name="line.451"></a>
+<span class="sourceLineNo">452</span>      this.queue = new LinkedBlockingQueue&lt;&gt;(perRegionServerBufferQueueSize);<a name="line.452"></a>
+<span class="sourceLineNo">453</span>      RpcRetryingCallerFactory rpcCallerFactory = RpcRetryingCallerFactory.instantiate(conf);<a name="line.453"></a>
+<span class="sourceLineNo">454</span>      RpcControllerFactory rpcControllerFactory = RpcControllerFactory.instantiate(conf);<a name="line.454"></a>
+<span class="sourceLineNo">455</span>      this.writeRpcTimeout = conf.getInt(HConstants.HBASE_RPC_WRITE_TIMEOUT_KEY,<a name="line.455"></a>
+<span class="sourceLineNo">456</span>          conf.getInt(HConstants.HBASE_RPC_TIMEOUT_KEY,<a name="line.456"></a>
+<span class="sourceLineNo">457</span>              HConstants.DEFAULT_HBASE_RPC_TIMEOUT));<a name="line.457"></a>
+<span class="sourceLineNo">458</span>      this.ap = new AsyncProcess(conn, conf, pool, rpcCallerFactory, false, rpcControllerFactory, writeRpcTimeout);<a name="line.458"></a>
+<span class="sourceLineNo">459</span>      this.executor = executor;<a name="line.459"></a>
+<span class="sourceLineNo">460</span>      this.maxRetryInQueue = conf.getInt(TABLE_MULTIPLEXER_MAX_RETRIES_IN_QUEUE, 10000);<a name="line.460"></a>
 <span class="sourceLineNo">461</span>    }<a name="line.461"></a>
 <span class="sourceLineNo">462</span><a name="line.462"></a>
-<span class="sourceLineNo">463</span>    public long getTotalFailedCount() {<a name="line.463"></a>
-<span class="sourceLineNo">464</span>      return totalFailedPutCount.get();<a name="line.464"></a>
+<span class="sourceLineNo">463</span>    protected LinkedBlockingQueue&lt;PutStatus&gt; getQueue() {<a name="line.463"></a>
+<span class="sourceLineNo">464</span>      return this.queue;<a name="line.464"></a>
 <span class="sourceLineNo">465</span>    }<a name="line.465"></a>
 <span class="sourceLineNo">466</span><a name="line.466"></a>
-<span class="sourceLineNo">467</span>    public long getTotalBufferedCount() {<a name="line.467"></a>
-<span class="sourceLineNo">468</span>      return queue.size() + currentProcessingCount.get();<a name="line.468"></a>
+<span class="sourceLineNo">467</span>    public long getTotalFailedCount() {<a name="line.467"></a>
+<span class="sourceLineNo">468</span>      return totalFailedPutCount.get();<a name="line.468"></a>
 <span class="sourceLineNo">469</span>    }<a name="line.469"></a>
 <span class="sourceLineNo">470</span><a name="line.470"></a>
-<span class="sourceLineNo">471</span>    public AtomicAverageCounter getAverageLatencyCounter() {<a name="line.471"></a>
-<span class="sourceLineNo">472</span>      return this.averageLatency;<a name="line.472"></a>
+<span class="sourceLineNo">471</span>    public long getTotalBufferedCount() {<a name="line.471"></a>
+<span class="sourceLineNo">472</span>      return queue.size() + currentProcessingCount.get();<a name="line.472"></a>
 <span class="sourceLineNo">473</span>    }<a name="line.473"></a>
 <span class="sourceLineNo">474</span><a name="line.474"></a>
-<span class="sourceLineNo">475</span>    public long getMaxLatency() {<a name="line.475"></a>
-<span class="sourceLineNo">476</span>      return this.maxLatency.getAndSet(0);<a name="line.476"></a>
+<span class="sourceLineNo">475</span>    public AtomicAverageCounter getAverageLatencyCounter() {<a name="line.475"></a>
+<span class="sourceLineNo">476</span>      return this.averageLatency;<a name="line.476"></a>
 <span class="sourceLineNo">477</span>    }<a name="line.477"></a>
 <span class="sourceLineNo">478</span><a name="line.478"></a>
-<span class="sourceLineNo">479</span>    boolean resubmitFailedPut(PutStatus ps, HRegionLocation oldLoc) throws IOException {<a name="line.479"></a>
-<span class="sourceLineNo">480</span>      // Decrease the retry count<a name="line.480"></a>
-<span class="sourceLineNo">481</span>      final int retryCount = ps.maxAttempCount - 1;<a name="line.481"></a>
+<span class="sourceLineNo">479</span>    public long getMaxLatency() {<a name="line.479"></a>
+<span class="sourceLineNo">480</span>      return this.maxLatency.getAndSet(0);<a name="line.480"></a>
+<span class="sourceLineNo">481</span>    }<a name="line.481"></a>
 <span class="sourceLineNo">482</span><a name="line.482"></a>
-<span class="sourceLineNo">483</span>      if (retryCount &lt;= 0) {<a name="line.483"></a>
-<span class="sourceLineNo">484</span>        // Update the failed counter and no retry any more.<a name="line.484"></a>
-<span class="sourceLineNo">485</span>        return false;<a name="line.485"></a>
-<span class="sourceLineNo">486</span>      }<a name="line.486"></a>
-<span class="sourceLineNo">487</span><a name="line.487"></a>
-<span class="sourceLineNo">488</span>      int cnt = getRetryInQueue().incrementAndGet();<a name="line.488"></a>
-<span class="sourceLineNo">489</span>      if (cnt &gt; getMaxRetryInQueue()) {<a name="line.489"></a>
-<span class="sourceLineNo">490</span>        // Too many Puts in queue for resubmit, give up this<a name="line.490"></a>
-<span class="sourceLineNo">491</span>        getRetryInQueue().decrementAndGet();<a name="line.491"></a>
-<span class="sourceLineNo">492</span>        return false;<a name="line.492"></a>
-<span class="sourceLineNo">493</span>      }<a name="line.493"></a>
-<span class="sourceLineNo">494</span><a name="line.494"></a>
-<span class="sourceLineNo">495</span>      final Put failedPut = ps.put;<a name="line.495"></a>
-<span class="sourceLineNo">496</span>      // The currentPut is failed. So get the table name for the currentPut.<a name="line.496"></a>
-<span class="sourceLineNo">497</span>      final TableName tableName = ps.regionInfo.getTable();<a name="line.497"></a>
+<span class="sourceLineNo">483</span>    boolean resubmitFailedPut(PutStatus ps, HRegionLocation oldLoc) throws IOException {<a name="line.483"></a>
+<span class="sourceLineNo">484</span>      // Decrease the retry count<a name="line.484"></a>
+<span class="sourceLineNo">485</span>      final int retryCount = ps.maxAttempCount - 1;<a name="line.485"></a>
+<span class="sourceLineNo">486</span><a name="line.486"></a>
+<span class="sourceLineNo">487</span>      if (retryCount &lt;= 0) {<a name="line.487"></a>
+<span class="sourceLineNo">488</span>        // Update the failed counter and no retry any more.<a name="line.488"></a>
+<span class="sourceLineNo">489</span>        return false;<a name="line.489"></a>
+<span class="sourceLineNo">490</span>      }<a name="line.490"></a>
+<span class="sourceLineNo">491</span><a name="line.491"></a>
+<span class="sourceLineNo">492</span>      int cnt = getRetryInQueue().incrementAndGet();<a name="line.492"></a>
+<span class="sourceLineNo">493</span>      if (cnt &gt; getMaxRetryInQueue()) {<a name="line.493"></a>
+<span class="sourceLineNo">494</span>        // Too many Puts in queue for resubmit, give up this<a name="line.494"></a>
+<span class="sourceLineNo">495</span>        getRetryInQueue().decrementAndGet();<a name="line.495"></a>
+<span class="sourceLineNo">496</span>        return false;<a name="line.496"></a>
+<span class="sourceLineNo">497</span>      }<a name="line.497"></a>
 <span class="sourceLineNo">498</span><a name="line.498"></a>
-<span class="sourceLineNo">499</span>      long delayMs = getNextDelay(retryCount);<a name="line.499"></a>
-<span class="sourceLineNo">500</span>      if (LOG.isDebugEnabled()) {<a name="line.500"></a>
-<span class="sourceLineNo">501</span>        LOG.debug("resubmitting after " + delayMs + "ms: " + retryCount);<a name="line.501"></a>
-<span class="sourceLineNo">502</span>      }<a name="line.502"></a>
-<span class="sourceLineNo">503</span><a name="line.503"></a>
-<span class="sourceLineNo">504</span>      // HBASE-12198, HBASE-15221, HBASE-15232: AsyncProcess should be responsible for updating<a name="line.504"></a>
-<span class="sourceLineNo">505</span>      // the region location cache when the Put original failed with some exception. If we keep<a name="line.505"></a>
-<span class="sourceLineNo">506</span>      // re-trying the same Put to the same location, AsyncProcess isn't doing the right stuff<a name="line.506"></a>
-<span class="sourceLineNo">507</span>      // that we expect it to.<a name="line.507"></a>
-<span class="sourceLineNo">508</span>      getExecutor().schedule(new Runnable() {<a name="line.508"></a>
-<span class="sourceLineNo">509</span>        @Override<a name="line.509"></a>
-<span class="sourceLineNo">510</span>        public void run() {<a name="line.510"></a>
-<span class="sourceLineNo">511</span>          boolean succ = false;<a name="line.511"></a>
-<span class="sourceLineNo">512</span>          try {<a name="line.512"></a>
-<span class="sourceLineNo">513</span>            succ = FlushWorker.this.getMultiplexer().put(tableName, failedPut, retryCount);<a name="line.513"></a>
-<span class="sourceLineNo">514</span>          } finally {<a name="line.514"></a>
-<span class="sourceLineNo">515</span>            FlushWorker.this.getRetryInQueue().decrementAndGet();<a name="line.515"></a>
-<span class="sourceLineNo">516</span>            if (!succ) {<a name="line.516"></a>
-<span class="sourceLineNo">517</span>              FlushWorker.this.getTotalFailedPutCount().incrementAndGet();<a name="line.517"></a>
-<span class="sourceLineNo">518</span>            }<a name="line.518"></a>
-<span class="sourceLineNo">519</span>          }<a name="line.519"></a>
-<span class="sourceLineNo">520</span>        }<a name="line.520"></a>
-<span class="sourceLineNo">521</span>      }, delayMs, TimeUnit.MILLISECONDS);<a name="line.521"></a>
-<span class="sourceLineNo">522</span>      return true;<a name="line.522"></a>
-<span class="sourceLineNo">523</span>    }<a name="line.523"></a>
-<span class="sourceLineNo">524</span><a name="line.524"></a>
-<span class="sourceLineNo">525</span>    @VisibleForTesting<a name="line.525"></a>
-<span class="sourceLineNo">526</span>    long getNextDelay(int retryCount) {<a name="line.526"></a>
-<span class="sourceLineNo">527</span>      return ConnectionUtils.getPauseTime(multiplexer.flushPeriod,<a name="line.527"></a>
-<span class="sourceLineNo">528</span>          multiplexer.maxAttempts - retryCount - 1);<a name="line.528"></a>
-<span class="sourceLineNo">529</span>    }<a name="line.529"></a>
-<span class="sourceLineNo">530</span><a name="line.530"></a>
-<span class="sourceLineNo">531</span>    @VisibleForTesting<a name="line.531"></a>
-<span class="sourceLineNo">532</span>    AtomicInteger getRetryInQueue() {<a name="line.532"></a>
-<span class="sourceLineNo">533</span>      return this.retryInQueue;<a name="line.533"></a>
-<span class="sourceLineNo">534</span>    }<a name="line.534"></a>
-<span class="sourceLineNo">535</span><a name="line.535"></a>
-<span class="sourceLineNo">536</span>    @VisibleForTesting<a name="line.536"></a>
-<span class="sourceLineNo">537</span>    int getMaxRetryInQueue() {<a name="line.537"></a>
-<span class="sourceLineNo">538</span>      return this.maxRetryInQueue;<a name="line.538"></a>
-<span class="sourceLineNo">539</span>    }<a name="line.539"></a>
-<span class="sourceLineNo">540</span><a name="line.540"></a>
-<span class="sourceLineNo">541</span>    @VisibleForTesting<a name="line.541"></a>
-<span class="sourceLineNo">542</span>    AtomicLong getTotalFailedPutCount() {<a name="line.542"></a>
-<span class="sourceLineNo">543</span>      return this.totalFailedPutCount;<a name="line.543"></a>
-<span class="sourceLineNo">544</span>    }<a name="line.544"></a>
-<span class="sourceLineNo">545</span><a name="line.545"></a>
-<span class="sourceLineNo">546</span>    @VisibleForTesting<a name="line.546"></a>
-<span class="sourceLineNo">547</span>    HTableMultiplexer getMultiplexer() {<a name="line.547"></a>
-<span class="sourceLineNo">548</span>      return this.multiplexer;<a name="line.548"></a>
-<span class="sourceLineNo">549</span>    }<a name="line.549"></a>
-<span class="sourceLineNo">550</span><a name="line.550"></a>
-<span class="sourceLineNo">551</span>    @VisibleForTesting<a name="line.551"></a>
-<span class="sourceLineNo">552</span>    ScheduledExecutorService getExecutor() {<a name="line.552"></a>
-<span class="sourceLineNo">553</span>      return this.executor;<a name="line.553"></a>
-<span class="sourceLineNo">554</span>    }<a name="line.554"></a>
-<span class="sourceLineNo">555</span><a name="line.555"></a>
-<span class="sourceLineNo">556</span>    @Override<a name="line.556"></a>
-<span class="sourceLineNo">557</span>    public void run() {<a name="line.557"></a>
-<span class="sourceLineNo">558</span>      int failedCount = 0;<a name="line.558"></a>
-<span class="sourceLineNo">559</span>      try {<a name="line.559"></a>
-<span class="sourceLineNo">560</span>        long start = EnvironmentEdgeManager.currentTime();<a name="line.560"></a>
-<span class="sourceLineNo">561</span><a name="line.561"></a>
-<span class="sourceLineNo">562</span>        // drain all the queued puts into the tmp list<a name="line.562"></a>
-<span class="sourceLineNo">563</span>        processingList.clear();<a name="line.563"></a>
-<span class="sourceLineNo">564</span>        queue.drainTo(processingList);<a name="line.564"></a>
-<span class="sourceLineNo">565</span>        if (processingList.size() == 0) {<a name="line.565"></a>
-<span class="sourceLineNo">566</span>          // Nothing to flush<a name="line.566"></a>
-<span class="sourceLineNo">567</span>          return;<a name="line.567"></a>
-<span class="sourceLineNo">568</span>        }<a name="line.568"></a>
-<span class="sourceLineNo">569</span><a name="line.569"></a>
-<span class="sourceLineNo">570</span>        currentProcessingCount.set(processingList.size());<a name="line.570"></a>
-<span class="sourceLineNo">571</span>        // failedCount is decreased whenever a Put is success or resubmit.<a name="line.571"></a>
-<span class="sourceLineNo">572</span>        failedCount = processingList.size();<a name="line.572"></a>
+<span class="sourceLineNo">499</span>      final Put failedPut = ps.put;<a name="line.499"></a>
+<span class="sourceLineNo">500</span>      // The currentPut is failed. So get the table name for the currentPut.<a name="line.500"></a>
+<span class="sourceLineNo">501</span>      final TableName tableName = ps.regionInfo.getTable();<a name="line.501"></a>
+<span class="sourceLineNo">502</span><a name="line.502"></a>
+<span class="sourceLineNo">503</span>      long delayMs = getNextDelay(retryCount);<a name="line.503"></a>
+<span class="sourceLineNo">504</span>      if (LOG.isDebugEnabled()) {<a name="line.504"></a>
+<span class="sourceLineNo">505</span>        LOG.debug("resubmitting after " + delayMs + "ms: " + retryCount);<a name="line.505"></a>
+<span class="sourceLineNo">506</span>      }<a name="line.506"></a>
+<span class="sourceLineNo">507</span><a name="line.507"></a>
+<span class="sourceLineNo">508</span>      // HBASE-12198, HBASE-15221, HBASE-15232: AsyncProcess should be responsible for updating<a name="line.508"></a>
+<span class="sourceLineNo">509</span>      // the region location cache when the Put original failed with some exception. If we keep<a name="line.509"></a>
+<span class="sourceLineNo">510</span>      // re-trying the same Put to the same location, AsyncProcess isn't doing the right stuff<a name="line.510"></a>
+<span class="sourceLineNo">511</span>      // that we expect it to.<a name="line.511"></a>
+<span class="sourceLineNo">512</span>      getExecutor().schedule(new Runnable() {<a name="line.512"></a>
+<span class="sourceLineNo">513</span>        @Override<a name="line.513"></a>
+<span class="sourceLineNo">514</span>        public void run() {<a name="line.514"></a>
+<span class="sourceLineNo">515</span>          boolean succ = false;<a name="line.515"></a>
+<span class="sourceLineNo">516</span>          try {<a name="line.516"></a>
+<span class="sourceLineNo">517</span>            succ = FlushWorker.this.getMultiplexer().put(tableName, failedPut, retryCount);<a name="line.517"></a>
+<span class="sourceLineNo">518</span>          } finally {<a name="line.518"></a>
+<span class="sourceLineNo">519</span>            FlushWorker.this.getRetryInQueue().decrementAndGet();<a name="line.519"></a>
+<span class="sourceLineNo">520</span>            if (!succ) {<a name="line.520"></a>
+<span class="sourceLineNo">521</span>              FlushWorker.this.getTotalFailedPutCount().incrementAndGet();<a name="line.521"></a>
+<span class="sourceLineNo">522</span>            }<a name="line.522"></a>
+<span class="sourceLineNo">523</span>          }<a name="line.523"></a>
+<span class="sourceLineNo">524</span>        }<a name="line.524"></a>
+<span class="sourceLineNo">525</span>      }, delayMs, TimeUnit.MILLISECONDS);<a name="line.525"></a>
+<span class="sourceLineNo">526</span>      return true;<a name="line.526"></a>
+<span class="sourceLineNo">527</span>    }<a name="line.527"></a>
+<span class="sourceLineNo">528</span><a name="line.528"></a>
+<span class="sourceLineNo">529</span>    @VisibleForTesting<a name="line.529"></a>
+<span class="sourceLineNo">530</span>    long getNextDelay(int retryCount) {<a name="line.530"></a>
+<span class="sourceLineNo">531</span>      return ConnectionUtils.getPauseTime(multiplexer.flushPeriod,<a name="line.531"></a>
+<span class="sourceLineNo">532</span>          multiplexer.maxAttempts - retryCount - 1);<a name="line.532"></a>
+<span class="sourceLineNo">533</span>    }<a name="line.533"></a>
+<span class="sourceLineNo">534</span><a name="line.534"></a>
+<span class="sourceLineNo">535</span>    @VisibleForTesting<a name="line.535"></a>
+<span class="sourceLineNo">536</span>    AtomicInteger getRetryInQueue() {<a name="line.536"></a>
+<span class="sourceLineNo">537</span>      return this.retryInQueue;<a name="line.537"></a>
+<span class="sourceLineNo">538</span>    }<a name="line.538"></a>
+<span class="sourceLineNo">539</span><a name="line.539"></a>
+<span class="sourceLineNo">540</span>    @VisibleForTesting<a name="line.540"></a>
+<span class="sourceLineNo">541</span>    int getMaxRetryInQueue() {<a name="line.541"></a>
+<span class="sourceLineNo">542</span>      return this.maxRetryInQueue;<a name="line.542"></a>
+<span class="sourceLineNo">543</span>    }<a name="line.543"></a>
+<span class="sourceLineNo">544</span><a name="line.544"></a>
+<span class="sourceLineNo">545</span>    @VisibleForTesting<a name="line.545"></a>
+<span class="sourceLineNo">546</span>    AtomicLong getTotalFailedPutCount() {<a name="line.546"></a>
+<span class="sourceLineNo">547</span>      return this.totalFailedPutCount;<a name="line.547"></a>
+<span class="sourceLineNo">548</span>    }<a name="line.548"></a>
+<span class="sourceLineNo">549</span><a name="line.549"></a>
+<span class="sourceLineNo">550</span>    @VisibleForTesting<a name="line.550"></a>
+<span class="sourceLineNo">551</span>    HTableMultiplexer getMultiplexer() {<a name="line.551"></a>
+<span class="sourceLineNo">552</span>      return this.multiplexer;<a name="line.552"></a>
+<span class="sourceLineNo">553</span>    }<a name="line.553"></a>
+<span class="sourceLineNo">554</span><a name="line.554"></a>
+<span class="sourceLineNo">555</span>    @VisibleForTesting<a name="line.555"></a>
+<span class="sourceLineNo">556</span>    ScheduledExecutorService getExecutor() {<a name="line.556"></a>
+<span class="sourceLineNo">557</span>      return this.executor;<a name="line.557"></a>
+<span class="sourceLineNo">558</span>    }<a name="line.558"></a>
+<span class="sourceLineNo">559</span><a name="line.559"></a>
+<span class="sourceLineNo">560</span>    @Override<a name="line.560"></a>
+<span class="sourceLineNo">561</span>    public void run() {<a name="line.561"></a>
+<span class="sourceLineNo">562</span>      int failedCount = 0;<a name="line.562"></a>
+<span class="sourceLineNo">563</span>      try {<a name="line.563"></a>
+<span class="sourceLineNo">564</span>        long start = EnvironmentEdgeManager.currentTime();<a name="line.564"></a>
+<span class="sourceLineNo">565</span><a name="line.565"></a>
+<span class="sourceLineNo">566</span>        // drain all the queued puts into the tmp list<a name="line.566"></a>
+<span class="sourceLineNo">567</span>        processingList.clear();<a name="line.567"></a>
+<span class="sourceLineNo">568</span>        queue.drainTo(processingList);<a name="line.568"></a>
+<span class="sourceLineNo">569</span>        if (processingList.size() == 0) {<a name="line.569"></a>
+<span class="sourceLineNo">570</span>          // Nothing to flush<a name="line.570"></a>
+<span class="sourceLineNo">571</span>          return;<a name="line.571"></a>
+<span class="sourceLineNo">572</span>        }<a name="line.572"></a>
 <span class="sourceLineNo">573</span><a name="line.573"></a>
-<span class="sourceLineNo">574</span>        List&lt;Action&lt;Row&gt;&gt; retainedActions = new ArrayList&lt;&gt;(processingList.size());<a name="line.574"></a>
-<span class="sourceLineNo">575</span>        MultiAction&lt;Row&gt; actions = new MultiAction&lt;&gt;();<a name="line.575"></a>
-<span class="sourceLineNo">576</span>        for (int i = 0; i &lt; processingList.size(); i++) {<a name="line.576"></a>
-<span class="sourceLineNo">577</span>          PutStatus putStatus = processingList.get(i);<a name="line.577"></a>
-<span class="sourceLineNo">578</span>          Action&lt;Row&gt; action = new Action&lt;Row&gt;(putStatus.put, i);<a name="line.578"></a>
-<span class="sourceLineNo">579</span>          actions.add(putStatus.regionInfo.getRegionName(), action);<a name="line.579"></a>
-<span class="sourceLineNo">580</span>          retainedActions.add(action);<a name="line.580"></a>
-<span class="sourceLineNo">581</span>        }<a name="line.581"></a>
-<span class="sourceLineNo">582</span><a name="line.582"></a>
-<span class="sourceLineNo">583</span>        // Process this multi-put request<a name="line.583"></a>
-<span class="sourceLineNo">584</span>        List&lt;PutStatus&gt; failed = null;<a name="line.584"></a>
-<span class="sourceLineNo">585</span>        Object[] results = new Object[actions.size()];<a name="line.585"></a>
-<span class="sourceLineNo">586</span>        ServerName server = addr.getServerName();<a name="line.586"></a>
-<span class="sourceLineNo">587</span>        Map&lt;ServerName, MultiAction&lt;Row&gt;&gt; actionsByServer =<a name="line.587"></a>
-<span class="sourceLineNo">588</span>            Collections.singletonMap(server, actions);<a name="line.588"></a>
-<span class="sourceLineNo">589</span>        try {<a name="line.589"></a>
-<span class="sourceLineNo">590</span>          AsyncRequestFuture arf =<a name="line.590"></a>
-<span class="sourceLineNo">591</span>              ap.submitMultiActions(null, retainedActions, 0L, null, results, true, null,<a name="line.591"></a>
-<span class="sourceLineNo">592</span>                null, actionsByServer, null);<a name="line.592"></a>
-<span class="sourceLineNo">593</span>          arf.waitUntilDone();<a name="line.593"></a>
-<span class="sourceLineNo">594</span>          if (arf.hasError()) {<a name="line.594"></a>
-<span class="sourceLineNo">595</span>            // We just log and ignore the exception here since failed Puts will be resubmit again.<a name="line.595"></a>
-<span class="sourceLineNo">596</span>            LOG.debug("Caught some exceptions when flushing puts to region server "<a name="line.596"></a>
-<span class="sourceLineNo">597</span>                + addr.getHostnamePort(), arf.getErrors());<a name="line.597"></a>
-<span class="sourceLineNo">598</span>          }<a name="line.598"></a>
-<span class="sourceLineNo">599</span>        } finally {<a name="line.599"></a>
-<span class="sourceLineNo">600</span>          for (int i = 0; i &lt; results.length; i++) {<a name="line.600"></a>
-<span class="sourceLineNo">601</span>            if (results[i] instanceof Result) {<a name="line.601"></a>
-<span class="sourceLineNo">602</span>              failedCount--;<a name="line.602"></a>
-<span class="sourceLineNo">603</span>            } else {<a name="line.603"></a>
-<span class="sourceLineNo">604</span>              if (failed == null) {<a name="line.604"></a>
-<span class="sourceLineNo">605</span>                failed = new ArrayList&lt;PutStatus&gt;();<a name="line.605"></a>
-<span class="sourceLineNo">606</span>              }<a name="line.606"></a>
-<span class="sourceLineNo">607</span>              failed.add(processingList.get(i));<a name="line.607"></a>
-<span class="sourceLineNo">608</span>            }<a name="line.608"></a>
-<span class="sourceLineNo">609</span>          }<a name="line.609"></a>
-<span class="sourceLineNo">610</span>        }<a name="line.610"></a>
-<span class="sourceLineNo">611</span><a name="line.611"></a>
-<span class="sourceLineNo">612</span>        if (failed != null) {<a name="line.612"></a>
-<span class="sourceLineNo">613</span>          // Resubmit failed puts<a name="line.613"></a>
-<span class="sourceLineNo">614</span>          for (PutStatus putStatus : failed) {<a name="line.614"></a>
-<span class="sourceLineNo">615</span>            if (resubmitFailedPut(putStatus, this.addr)) {<a name="line.615"></a>
-<span class="sourceLineNo">616</span>              failedCount--;<a name="line.616"></a>
-<span class="sourceLineNo">617</span>            }<a name="line.617"></a>
-<span class="sourceLineNo">618</span>          }<a name="line.618"></a>
-<span class="sourceLineNo">619</span>        }<a name="line.619"></a>
-<span class="sourceLineNo">620</span><a name="line.620"></a>
-<span class="sourceLineNo">621</span>        long elapsed = EnvironmentEdgeManager.currentTime() - start;<a name="line.621"></a>
-<span class="sourceLineNo">622</span>        // Update latency counters<a name="line.622"></a>
-<span class="sourceLineNo">623</span>        averageLatency.add(elapsed);<a name="line.623"></a>
-<span class="sourceLineNo">624</span>        if (elapsed &gt; maxLatency.get()) {<a name="line.624"></a>
-<span class="sourceLineNo">625</span>          maxLatency.set(elapsed);<a name="line.625"></a>
-<span class="sourceLineNo">626</span>        }<a name="line.626"></a>
-<span class="sourceLineNo">627</span><a name="line.627"></a>
-<span class="sourceLineNo">628</span>        // Log some basic info<a name="line.628"></a>
-<span class="sourceLineNo">629</span>        if (LOG.isDebugEnabled()) {<a name="line.629"></a>
-<span class="sourceLineNo">630</span>          LOG.debug("Processed " + currentProcessingCount + " put requests for "<a name="line.630"></a>
-<span class="sourceLineNo">631</span>              + addr.getHostnamePort() + " and " + failedCount + " failed"<a name="line.631"></a>
-<span class="sourceLineNo">632</span>              + ", latency for this send: " + elapsed);<a name="line.632"></a>
-<span class="sourceLineNo">633</span>        }<a name="line.633"></a>
-<span class="sourceLineNo">634</span><a name="line.634"></a>
-<span class="sourceLineNo">635</span>        // Reset the current processing put count<a name="line.635"></a>
-<span class="sourceLineNo">636</span>        currentProcessingCount.set(0);<a name="line.636"></a>
-<span class="sourceLineNo">637</span>      } catch (RuntimeException e) {<a name="line.637"></a>
-<span class="sourceLineNo">638</span>        // To make findbugs happy<a name="line.638"></a>
-<span class="sourceLineNo">639</span>        // Log all the exceptions and move on<a name="line.639"></a>
-<span class="sourceLineNo">640</span>        LOG.debug(<a name="line.640"></a>
-<span class="sourceLineNo">641</span>          "Caught some exceptions " + e + " when flushing puts to region server "<a name="line.641"></a>
-<span class="sourceLineNo">642</span>              + addr.getHostnamePort(), e);<a name="line.642"></a>
-<span class="sourceLineNo">643</span>      } catch (Exception e) {<a name="line.643"></a>
-<span class="sourceLineNo">644</span>        if (e instanceof InterruptedException) {<a name="line.644"></a>
-<span class="sourceLineNo">645</span>          Thread.currentThread().interrupt();<a name="line.645"></a>
-<span class="sourceLineNo">646</span>        }<a name="line.646"></a>
-<span class="sourceLineNo">647</span>        // Log all the exceptions and move on<a name="line.647"></a>
-<span class="sourceLineNo">648</span>        LOG.debug(<a name="line.648"></a>
-<span class="sourceLineNo">649</span>          "Caught some exceptions " + e + " when flushing puts to region server "<a name="line.649"></a>
-<span class="sourceLineNo">650</span>              + addr.getHostnamePort(), e);<a name="line.650"></a>
-<span class="sourceLineNo">651</span>      } finally {<a name="line.651"></a>
-<span class="sourceLineNo">652</span>        // Update the totalFailedCount<a name="line.652"></a>
-<span class="sourceLineNo">653</span>        this.totalFailedPutCount.addAndGet(failedCount);<a name="line.653"></a>
-<span class="sourceLineNo">654</span>      }<a name="line.654"></a>
-<span class="sourceLineNo">655</span>    }<a name="line.655"></a>
-<span class="sourceLineNo">656</span>  }<a name="line.656"></a>
-<span class="sourceLineNo">657</span>}<a name="line.657"></a>
+<span class="sourceLineNo">574</span>        currentProcessingCount.set(processingList.size());<a name="line.574"></a>
+<span class="sourceLineNo">575</span>        // failedCount is decreased whenever a Put is success or resubmit.<a name="line.575"></a>
+<span class="sourceLineNo">576</span>        failedCount = processingList.size();<a name="line.576"></a>
+<span class="sourceLineNo">577</span><a name="line.577"></a>
+<span class="sourceLineNo">578</span>        List&lt;Action&lt;Row&gt;&gt; retainedActions = new ArrayList&lt;&gt;(processingList.size());<a name="line.578"></a>
+<span class="sourceLineNo">579</span>        MultiAction&lt;Row&gt; actions = new MultiAction&lt;&gt;();<a name="line.579"></a>
+<span class="sourceLineNo">580</span>        for (int i = 0; i &lt; processingList.size(); i++) {<a name="line.580"></a>
+<span class="sourceLineNo">581</span>          PutStatus putStatus = processingList.get(i);<a name="line.581"></a>
+<span class="sourceLineNo">582</span>          Action&lt;Row&gt; action = new Action&lt;Row&gt;(putStatus.put, i);<a name="line.582"></a>
+<span class="sourceLineNo">583</span>          actions.add(putStatus.regionInfo.getRegionName(), action);<a name="line.583"></a>
+<span class="sourceLineNo">584</span>          retainedActions.add(action);<a name="line.584"></a>
+<span class="sourceLineNo">585</span>        }<a name="line.585"></a>
+<span class="sourceLineNo">586</span><a name="line.586"></a>
+<span class="sourceLineNo">587</span>        // Process this multi-put request<a name="line.587"></a>
+<span class="sourceLineNo">588</span>        List&lt;PutStatus&gt; failed = null;<a name="line.588"></a>
+<span class="sourceLineNo">589</span>        Object[] results = new Object[actions.size()];<a name="line.589"></a>
+<span class="sourceLineNo">590</span>        ServerName server = addr.getServerName();<a name="line.590"></a>
+<span class="sourceLineNo">591</span>        Map&lt;ServerName, MultiAction&lt;Row&gt;&gt; actionsByServer =<a name="line.591"></a>
+<span class="sourceLineNo">592</span>            Collections.singletonMap(server, actions);<a name="line.592"></a>
+<span class="sourceLineNo">593</span>        try {<a name="line.593"></a>
+<span class="sourceLineNo">594</span>          AsyncRequestFuture arf =<a name="line.594"></a>
+<span class="sourceLineNo">595</span>              ap.submitMultiActions(null, retainedActions, 0L, null, results, true, null,<a name="line.595"></a>
+<span class="sourceLineNo">596</span>                null, actionsByServer, null);<a name="line.596"></a>
+<span class="sourceLineNo">597</span>          arf.waitUntilDone();<a name="line.597"></a>
+<span class="sourceLineNo">598</span>          if (arf.hasError()) {<a name="line.598"></a>
+<span class="sourceLineNo">599</span>            // We just log and ignore the exception here since failed Puts will be resubmit again.<a name="line.599"></a>
+<span class="sourceLineNo">600</span>            LOG.debug("Caught some exceptions when flushing puts to region server "<a name="line.600"></a>
+<span class="sourceLineNo">601</span>                + addr.getHostnamePort(), arf.getErrors());<a name="line.601"></a>
+<span class="sourceLineNo">602</span>          }<a name="line.602"></a>
+<span class="sourceLineNo">603</span>        } finally {<a name="line.603"></a>
+<span class="sourceLineNo">604</span>          for (int i = 0; i &lt; results.length; i++) {<a name="line.604"></a>
+<span class="sourceLineNo">605</span>            if (results[i] instanceof Result) {<a name="line.605"></a>
+<span class="sourceLineNo">606</span>              failedCount--;<a name="line.606"></a>
+<span class="sourceLineNo">607</span>            } else {<a name="line.607"></a>
+<span class="sourceLineNo">608</span>              if (failed == null) {<a name="line.608"></a>
+<span class="sourceLineNo">609</span>                failed = new ArrayList&lt;PutStatus&gt;();<a name="line.609"></a>
+<span class="sourceLineNo">610</span>              }<a name="line.610"></a>
+<span class="sourceLineNo">611</span>              failed.add(processingList.get(i));<a name="line.611"></a>
+<span class="sourceLineNo">612</span>            }<a name="line.612"></a>
+<span class="sourceLineNo">613</span>          }<a name="line.613"></a>
+<span class="sourceLineNo">614</span>        }<a name="line.614"></a>
+<span class="sourceLineNo">615</span><a name="line.615"></a>
+<span class="sourceLineNo">616</span>        if (failed != null) {<a name="line.616"></a>
+<span class="sourceLineNo">617</span>          // Resubmit failed puts<a name="line.617"></a>
+<span class="sourceLineNo">618</span>          for (PutStatus putStatus : failed) {<a name="line.618"></a>
+<span class="sourceLineNo">619</span>            if (resubmitFailedPut(putStatus, this.addr)) {<a name="line.619"></a>
+<span class="sourceLineNo">620</span>              failedCount--;<a name="line.620"></a>
+<span class="sourceLineNo">621</span>            }<a name="line.621"></a>
+<span class="sourceLineNo">622</span>          }<a name="line.622"></a>
+<span class="sourceLineNo">623</span>        }<a name="line.623"></a>
+<span class="sourceLineNo">624</span><a name="line.624"></a>
+<span class="sourceLineNo">625</span>        long elapsed = EnvironmentEdgeManager.currentTime() - start;<a name="line.625"></a>
+<span class="sourceLineNo">626</span>        // Update latency counters<a name="line.626"></a>
+<span class="sourceLineNo">627</span>        averageLatency.add(elapsed);<a name="line.627"></a>
+<span class="sourceLineNo">628</span>        if (elapsed &gt; maxLatency.get()) {<a name="line.628"></a>
+<span class="sourceLineNo">629</span>          maxLatency.set(elapsed);<a name="line.629"></a>
+<span class="sourceLineNo">630</span>        }<a name="line.630"></a>
+<span class="sourceLineNo">631</span><a name="line.631"></a>
+<span class="sourceLineNo">632</span>        // Log some basic info<a name="line.632"></a>
+<span class="sourceLineNo">633</span>        if (LOG.isDebugEnabled()) {<a name="line.633"></a>
+<span class="sourceLineNo">634</span>          LOG.debug("Processed " + currentProcessingCount + " put requests for "<a name="line.634"></a>
+<span class="sourceLineNo">635</span>              + addr.getHostnamePort() + " and " + failedCount + " failed"<a name="line.635"></a>
+<span class="sourceLineNo">636</span>              + ", latency for this send: " + elapsed);<a name="line.636"></a>
+<span class="sourceLineNo">637</span>        }<a name="line.637"></a>
+<span class="sourceLineNo">638</span><a name="line.638"></a>
+<span class="sourceLineNo">639</span>        // Reset the current processing put count<a name="line.639"></a>
+<span class="sourceLineNo">640</span>        currentProcessingCount.set(0);<a name="line.640"></a>
+<span class="sourceLineNo">641</span>      } catch (RuntimeException e) {<a name="line.641"></a>
+<span class="sourceLineNo">642</span>        // To make findbugs happy<a name="line.642"></a>
+<span class="sourceLineNo">643</span>        // Log all the exceptions and move on<a name="line.643"></a>
+<span class="sourceLineNo">644</span>        LOG.debug(<a name="line.644"></a>
+<span class="sourceLineNo">645</span>          "Caught some exceptions " + e + " when flushing puts to region server "<a name="line.645"></a>
+<span class="sourceLineNo">646</span>              + addr.getHostnamePort(), e);<a name="line.646"></a>
+<span class="sourceLineNo">647</span>      } catch (Exception e) {<a name="line.647"></a>
+<span class="sourceLineNo">648</span>        if (e instanceof InterruptedException) {<a name="line.648"></a>
+<span class="sourceLineNo">649</span>          Thread.currentThread().interrupt();<a name="line.649"></a>
+<span class="sourceLineNo">650</span>        }<a name="line.650"></a>
+<span class="sourceLineNo">651</span>        // Log all the exceptions and move on<a name="line.651"></a>
+<span class="sourceLineNo">652</span>        LOG.debug(<a name="line.652"></a>
+<span class="sourceLineNo">653</span>          "Caught some exceptions " + e + " when flushing puts to region server "<a name="line.653"></a>
+<span class="sourceLineNo">654</span>              + addr.getHostnamePort(), e);<a name="line.654"></a>
+<span class="sourceLineNo">655</span>      } finally {<a name="line.655"></a>
+<span class="sourceLineNo">656</span>        // Update the totalFailedCount<a name="line.656"></a>
+<span class="sourceLineNo">657</span>        this.totalFailedPutCount.addAndGet(failedCount);<a name="line.657"></a>
+<span class="sourceLineNo">658</span>      }<a name="line.658"></a>
+<span class="sourceLineNo">659</span>    }<a name="line.659"></a>
+<span class="sourceLineNo">660</span>  }<a name="line.660"></a>
+<span class="sourceLineNo">661</span>}<a name="line.661"></a>
 
 
 


Mime
View raw message