Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.apache.hadoop.hbase.master;
 
 import java.util.Map;
 
Callback handler for creating unassigned offline znodes used during bulk assign, async setting region to offline.
 
 public class OfflineCallback implements StringCallback {
   private final Log LOG = LogFactory.getLog(OfflineCallback.class);
   private final ExistCallback callBack;
   private final ZooKeeperWatcher zkw;
   private final ServerName destination;
   private final AtomicInteger counter;
 
       final ServerName destinationfinal AtomicInteger counter,
       final Map<StringIntegerofflineNodesVersions) {
     this. = new ExistCallback(
       destinationcounterofflineNodesVersions);
     this. = destination;
     this. = counter;
     this. = zkw;
   }
 
   @Override
   public void processResult(int rcString pathObject ctxString name) {
     if (rc == ...intValue()) {
       .warn("Node for " + path + " already exists");
     } else if (rc != 0) {
       // This is result code.  If non-zero, need to resubmit.
       .warn("rc != 0 for " + path + " -- retryable connectionloss -- " +
         "FIX see http://wiki.apache.org/hadoop/ZooKeeper/FAQ#A2");
       this..addAndGet(1);
       return;
     }
 
     if (.isDebugEnabled()) {
       .debug("rs=" + ctx + ", server=" + );
     }
     // Async exists to set a watcher so we'll get triggered when
     // unassigned node changes.
     zk.exists(paththis.ctx);
   }

  
Callback handler for the exists call that sets watcher on unassigned znodes. Used during bulk assign on startup.
 
   static class ExistCallback implements StatCallback {
     private final Log LOG = LogFactory.getLog(ExistCallback.class);
     private final Map<StringIntegerofflineNodesVersions;
     private final AtomicInteger counter;
     private ServerName destination;
 
     ExistCallback(final ServerName destination,
         final AtomicInteger counter,
         final Map<StringIntegerofflineNodesVersions) {
       this. = offlineNodesVersions;
       this. = destination;
       this. = counter;
     }
 
     @Override
     public void processResult(int rcString pathObject ctxStat stat) {
       if (rc != 0) {
         // This is result code.  If non-zero, need to resubmit.
         .warn("rc != 0 for " + path + " -- retryable connectionloss -- " +
          "FIX see http://wiki.apache.org/hadoop/ZooKeeper/FAQ#A2");
        this..addAndGet(1);
        return;
      }
      if (.isDebugEnabled()) {
        .debug("rs=" + ctx + ", server=" + );
      }
      HRegionInfo region = ((RegionState)ctx).getRegion();
        region.getEncodedName(), Integer.valueOf(stat.getVersion()));
      this..addAndGet(1);
    }
  }
New to GrepCode? Check out our FAQ X