当前位置: 首页>>代码示例>>Java>>正文


Java Abortable类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.Abortable的典型用法代码示例。如果您正苦于以下问题:Java Abortable类的具体用法?Java Abortable怎么用?Java Abortable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Abortable类属于org.apache.hadoop.hbase包,在下文中一共展示了Abortable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
@Override
public RpcScheduler create(Configuration conf, PriorityFunction priority, Abortable server) {
  int handlerCount = conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT,
HConstants.DEFAULT_REGION_SERVER_HANDLER_COUNT);

  return new SimpleRpcScheduler(
    conf,
    handlerCount,
    conf.getInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT,
      HConstants.DEFAULT_REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT),
    conf.getInt(HConstants.REGION_SERVER_REPLICATION_HANDLER_COUNT,
        HConstants.DEFAULT_REGION_SERVER_REPLICATION_HANDLER_COUNT),
    priority,
    server,
    HConstants.QOS_THRESHOLD);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:SimpleRpcSchedulerFactory.java

示例2: setUpBeforeClass

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniZKCluster();
  Configuration conf = TEST_UTIL.getConfiguration();
  conf.setBoolean("hbase.zookeeper.useMulti", true);
  Abortable abortable = new Abortable() {
    @Override
    public void abort(String why, Throwable e) {
      LOG.info(why, e);
    }

    @Override
    public boolean isAborted() {
      return false;
    }
  };
  zkw = new ZooKeeperWatcher(conf,
    "TestZKMulti", abortable, true);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:TestZKMulti.java

示例3: tearDown

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
@After
public void tearDown()
throws KeeperException, ZooKeeperConnectionException, IOException {
  // Make sure zk is clean before we run the next test.
  ZooKeeperWatcher zkw = new ZooKeeperWatcher(TESTUTIL.getConfiguration(),
      "@Before", new Abortable() {
    @Override
    public void abort(String why, Throwable e) {
      throw new RuntimeException(why, e);
    }

    @Override
    public boolean isAborted() {
      return false;
    }
  });
  ZKUtil.deleteNodeRecursively(zkw, zkw.baseZNode);
  zkw.close();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:TestMasterNoCluster.java

示例4: testRpcScheduler

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
@Ignore
@Test
public void testRpcScheduler() throws IOException, InterruptedException {
  PriorityFunction qosFunction = mock(PriorityFunction.class);
  Abortable abortable = new AbortServer();
  RpcScheduler scheduler = new SimpleRpcScheduler(CONF, 2, 0, 0, qosFunction, abortable, 0);
  RpcServer rpcServer = new TestRpcServer(scheduler);
  RpcClientImpl client = new RpcClientImpl(CONF, HConstants.CLUSTER_ID_DEFAULT);
  try {
    rpcServer.start();
    MethodDescriptor md = SERVICE.getDescriptorForType().findMethodByName("echo");
    EchoRequestProto param = EchoRequestProto.newBuilder().setMessage("hello").build();
    PayloadCarryingRpcController controller =
        new PayloadCarryingRpcController(CellUtil.createCellScanner(ImmutableList.of(CELL)));
    InetSocketAddress address = rpcServer.getListenerAddress();
    if (address == null) {
      throw new IOException("Listener channel is closed");
    }
    client.call(controller, md, param, md.getOutputType().toProto(), User.getCurrent(),
        address, new MetricsConnection.CallStats());
  } catch (Throwable e) {
    assert(abortable.isAborted() == true);
  } finally {
    rpcServer.stop();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:TestRpcHandlerException.java

示例5: createZooKeeperWatcher

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
private ZooKeeperWatcher createZooKeeperWatcher() throws IOException {
  // This Abortable doesn't 'abort'... it just logs.
  return new ZooKeeperWatcher(connection.getConfiguration(), "ReplicationAdmin", new Abortable() {
    @Override
    public void abort(String why, Throwable e) {
      LOG.error(why, e);
      // We used to call system.exit here but this script can be embedded by other programs that
      // want to do replication stuff... so inappropriate calling System.exit. Just log for now.
    }

    @Override
    public boolean isAborted() {
      return false;
    }
  });
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:ReplicationAdmin.java

示例6: ZooKeeperWatcher

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
/**
 * Instantiate a ZooKeeper connection and watcher.
 * @param conf
 * @param identifier string that is passed to RecoverableZookeeper to be used as identifier for
 *          this instance. Use null for default.
 * @param abortable Can be null if there is on error there is no host to abort: e.g. client
 *          context.
 * @param canCreateBaseZNode
 * @throws IOException
 * @throws ZooKeeperConnectionException
 */
public ZooKeeperWatcher(Configuration conf, String identifier,
    Abortable abortable, boolean canCreateBaseZNode)
throws IOException, ZooKeeperConnectionException {
  this.conf = conf;
  // Capture a stack trace now.  Will print it out later if problem so we can
  // distingush amongst the myriad ZKWs.
  try {
    throw new Exception("ZKW CONSTRUCTOR STACK TRACE FOR DEBUGGING");
  } catch (Exception e) {
    this.constructorCaller = e;
  }
  this.quorum = ZKConfig.getZKQuorumServersString(conf);
  this.prefix = identifier;
  // Identifier will get the sessionid appended later below down when we
  // handle the syncconnect event.
  this.identifier = identifier + "0x0";
  this.abortable = abortable;
  setNodeNames(conf);
  this.recoverableZooKeeper = ZKUtil.connect(conf, quorum, this, identifier);
  if (canCreateBaseZNode) {
    createBaseZNodes();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:ZooKeeperWatcher.java

示例7: setZNodes

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
private void setZNodes(Abortable abortable) throws KeeperException {
  String replicationZNodeName =
      conf.get("zookeeper.znode.replication", "replication");
  String peersZNodeName =
      conf.get("zookeeper.znode.replication.peers", "peers");
  this.peerStateNodeName = conf.get(
      "zookeeper.znode.replication.peers.state", "peer-state");
  this.replicationStateNodeName =
      conf.get("zookeeper.znode.replication.state", "state");
  String rsZNodeName =
      conf.get("zookeeper.znode.replication.rs", "rs");
  this.ourClusterKey = ZKUtil.getZooKeeperClusterKey(this.conf);
  this.replicationZNode =
    ZKUtil.joinZNode(this.zookeeper.baseZNode, replicationZNodeName);
  this.peersZNode = ZKUtil.joinZNode(replicationZNode, peersZNodeName);
  ZKUtil.createWithParents(this.zookeeper, this.peersZNode);
  this.rsZNode = ZKUtil.joinZNode(replicationZNode, rsZNodeName);
  ZKUtil.createWithParents(this.zookeeper, this.rsZNode);

  // Set a tracker on replicationStateNodeNode
  this.statusTracker =
      new ReplicationStatusTracker(this.zookeeper, abortable);
  statusTracker.start();
  readReplicationStateZnode();
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:26,代码来源:ReplicationZookeeper.java

示例8: ZooKeeperWatcher

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
/**
 * Instantiate a ZooKeeper connection and watcher.
 * @param descriptor Descriptive string that is added to zookeeper sessionid
 * and used as identifier for this instance.
 * @throws IOException
 * @throws ZooKeeperConnectionException
 */
public ZooKeeperWatcher(Configuration conf, String descriptor,
    Abortable abortable, boolean canCreateBaseZNode)
throws IOException, ZooKeeperConnectionException {
  this.conf = conf;
  // Capture a stack trace now.  Will print it out later if problem so we can
  // distingush amongst the myriad ZKWs.
  try {
    throw new Exception("ZKW CONSTRUCTOR STACK TRACE FOR DEBUGGING");
  } catch (Exception e) {
    this.constructorCaller = e;
  }
  this.quorum = ZKConfig.getZKQuorumServersString(conf);
  // Identifier will get the sessionid appended later below down when we
  // handle the syncconnect event.
  this.identifier = descriptor;
  this.abortable = abortable;
  setNodeNames(conf);
  this.recoverableZooKeeper = ZKUtil.connect(conf, quorum, this, descriptor);
  if (canCreateBaseZNode) {
    createBaseZNodes();
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:30,代码来源:ZooKeeperWatcher.java

示例9: getRootRegionServerName

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
private ServerName getRootRegionServerName()
throws IOException, InterruptedException {
  RootRegionTracker rootRegionTracker =
    new RootRegionTracker(this.connection.getZooKeeperWatcher(), new Abortable() {
      @Override
      public void abort(String why, Throwable e) {
        LOG.error(why, e);
        System.exit(1);
      }
      @Override
      public boolean isAborted(){
        return false;
      }
      
    });
  rootRegionTracker.start();
  ServerName sn = null;
  try {
    sn = rootRegionTracker.getRootRegionLocation();
  } finally {
    rootRegionTracker.stop();
  }
  return sn;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:25,代码来源:HBaseFsck.java

示例10: testRpcScheduler

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
@Ignore
@Test
public void testRpcScheduler() throws IOException, InterruptedException {
  PriorityFunction qosFunction = mock(PriorityFunction.class);
  Abortable abortable = new AbortServer();
  RpcScheduler scheduler = new SimpleRpcScheduler(CONF, 2, 0, 0, qosFunction, abortable, 0);
  RpcServer rpcServer = new TestRpcServer(scheduler);
  RpcClientImpl client = new RpcClientImpl(CONF, HConstants.CLUSTER_ID_DEFAULT);
  try {
    rpcServer.start();
    MethodDescriptor md = SERVICE.getDescriptorForType().findMethodByName("echo");
    EchoRequestProto param = EchoRequestProto.newBuilder().setMessage("hello").build();
    client.call(null, md, param, CellUtil.createCellScanner(ImmutableList.of(CELL)), md
      .getOutputType().toProto(), User.getCurrent(), rpcServer.getListenerAddress(), 0);
  } catch (Throwable e) {
    assert(abortable.isAborted() == true);
  } finally {
    rpcServer.stop();
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:21,代码来源:TestRpcHandlerException.java

示例11: createZooKeeperWatcher

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
private ZooKeeperWatcher createZooKeeperWatcher() throws IOException {
  return new ZooKeeperWatcher(connection.getConfiguration(),
    "Replication Admin", new Abortable() {
    @Override
    public void abort(String why, Throwable e) {
      LOG.error(why, e);
      System.exit(1);
    }

    @Override
    public boolean isAborted() {
      return false;
    }

  });
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:17,代码来源:ReplicationAdmin.java

示例12: ZooKeeperWatcher

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
/**
 * Instantiate a ZooKeeper connection and watcher.
 * @param conf
 * @param identifier string that is passed to RecoverableZookeeper to be used as identifier for
 *          this instance. Use null for default.
 * @param abortable Can be null if there is on error there is no host to abort: e.g. client
 *          context.
 * @param canCreateBaseZNode
 * @throws IOException
 * @throws ZooKeeperConnectionException
 */
public ZooKeeperWatcher(Configuration conf, String identifier,
    Abortable abortable, boolean canCreateBaseZNode)
throws IOException, ZooKeeperConnectionException {
  this.conf = conf;
  // Capture a stack trace now.  Will print it out later if problem so we can
  // distingush amongst the myriad ZKWs.
  try {
    throw new Exception("ZKW CONSTRUCTOR STACK TRACE FOR DEBUGGING");
  } catch (Exception e) {
    this.constructorCaller = e;
  }
  this.quorum = ZKConfig.getZKQuorumServersString(conf);
  // Identifier will get the sessionid appended later below down when we
  // handle the syncconnect event.
  this.identifier = identifier;
  this.abortable = abortable;
  setNodeNames(conf);
  this.recoverableZooKeeper = ZKUtil.connect(conf, quorum, this, identifier);
  if (canCreateBaseZNode) {
    createBaseZNodes();
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:34,代码来源:ZooKeeperWatcher.java

示例13: Context

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
@InterfaceAudience.Private
public Context(
    final Configuration localConf,
    final Configuration conf,
    final FileSystem fs,
    final String peerId,
    final UUID clusterId,
    final ReplicationPeer replicationPeer,
    final MetricsSource metrics,
    final TableDescriptors tableDescriptors,
    final Abortable abortable) {
  this.localConf = localConf;
  this.conf = conf;
  this.fs = fs;
  this.clusterId = clusterId;
  this.peerId = peerId;
  this.replicationPeer = replicationPeer;
  this.metrics = metrics;
  this.tableDescriptors = tableDescriptors;
  this.abortable = abortable;
}
 
开发者ID:apache,项目名称:hbase,代码行数:22,代码来源:ReplicationEndpoint.java

示例14: SplitOrMergeTracker

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
public SplitOrMergeTracker(ZKWatcher watcher, Configuration conf,
                           Abortable abortable) {
  try {
    if (ZKUtil.checkExists(watcher, watcher.znodePaths.switchZNode) < 0) {
      ZKUtil.createAndFailSilent(watcher, watcher.znodePaths.switchZNode);
    }
  } catch (KeeperException e) {
    throw new RuntimeException(e);
  }
  splitZnode = ZNodePaths.joinZNode(watcher.znodePaths.switchZNode,
    conf.get("zookeeper.znode.switch.split", "split"));
  mergeZnode = ZNodePaths.joinZNode(watcher.znodePaths.switchZNode,
    conf.get("zookeeper.znode.switch.merge", "merge"));
  splitStateTracker = new SwitchStateTracker(watcher, splitZnode, abortable);
  mergeStateTracker = new SwitchStateTracker(watcher, mergeZnode, abortable);
}
 
开发者ID:apache,项目名称:hbase,代码行数:17,代码来源:SplitOrMergeTracker.java

示例15: setUpBeforeClass

import org.apache.hadoop.hbase.Abortable; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniZKCluster();
  Configuration conf = TEST_UTIL.getConfiguration();
  abortable = new Abortable() {
    @Override
    public void abort(String why, Throwable e) {
      LOG.info(why, e);
    }

    @Override
    public boolean isAborted() {
      return false;
    }
  };
  zkw = new ZKWatcher(conf, "TableCFs", abortable, true);
  zkStorageUtil = new ZKStorageUtil(zkw, conf);
}
 
开发者ID:apache,项目名称:hbase,代码行数:19,代码来源:TestTableCFsUpdater.java


注:本文中的org.apache.hadoop.hbase.Abortable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。