Package org.apache.accumulo.server.zookeeper

Examples of org.apache.accumulo.server.zookeeper.TransactionWatcher


    final Logger log = Logger.getLogger(ZombieTServer.class);
    Random random = new Random(System.currentTimeMillis() % 1000);
    int port = random.nextInt(30000) + 2000;
    Instance instance = HdfsZooInstance.getInstance();
   
    TransactionWatcher watcher = new TransactionWatcher();
    final ThriftClientHandler tch = new ThriftClientHandler(instance, watcher);
    Processor<Iface> processor = new Processor<Iface>(tch);
    ServerPort serverPort = TServerUtils.startTServer(port, processor, "ZombieTServer", "walking dead", 2, 1000, 10*1024*1024);
   
    InetSocketAddress addr = new InetSocketAddress(InetAddress.getLocalHost(), serverPort.port);
View Full Code Here


 
  public static void main(String[] args) throws Exception {
    Opts opts = new Opts();
    opts.parseArgs(NullTserver.class.getName(), args);
   
    TransactionWatcher watcher = new TransactionWatcher();
    ThriftClientHandler tch = new ThriftClientHandler(HdfsZooInstance.getInstance(), watcher);
    Processor<Iface> processor = new Processor<Iface>(tch);
    TServerUtils.startTServer(opts.port, processor, "NullTServer", "null tserver", 2, 1000, 10*1024*1024);
   
    InetSocketAddress addr = new InetSocketAddress(InetAddress.getLocalHost(), opts.port);
View Full Code Here

  @Test
  public void testTransactionWatcher() throws Exception {
    final String txType = "someName";
    final long txid = 7;
    final SimpleArbitrator sa = new SimpleArbitrator();
    final TransactionWatcher txw = new TransactionWatcher(sa);
    sa.start(txType, txid);
    try {
      sa.start(txType, txid);
      Assert.fail("simple arbitrator did not throw an exception");
    } catch (Exception ex) {
      // expected
    }
    txw.isActive(txid);
    Assert.assertFalse(txw.isActive(txid));
    txw.run(txType, txid, new Callable<Object>() {
      @Override
      public Object call() throws Exception {
        Assert.assertTrue(txw.isActive(txid));
        return null;
      }
    });
    Assert.assertFalse(txw.isActive(txid));
    Assert.assertFalse(sa.transactionComplete(txType,  txid));
    sa.stop(txType, txid);
    Assert.assertFalse(sa.transactionAlive(txType, txid));
    Assert.assertFalse(sa.transactionComplete(txType,  txid));
    sa.cleanup(txType, txid);
    Assert.assertTrue(sa.transactionComplete(txType,  txid));
    try {
      txw.run(txType, txid, new Callable<Object>() {
        @Override
        public Object call() throws Exception {
          Assert.fail("Should not be able to start a new work on a discontinued transaction");
          return null;
        }
      });
      Assert.fail("work against stopped transaction should fail");
    } catch (Exception ex) {
      ;
    }
    final long txid2 = 9;
    sa.start(txType, txid2);
    txw.run(txType, txid2, new Callable<Object>() {
      @Override
      public Object call() throws Exception {
        Assert.assertTrue(txw.isActive(txid2));
        sa.stop(txType, txid2);
        try {
          txw.run(txType, txid2, new Callable<Object>() {
            @Override
            public Object call() throws Exception {
              Assert.fail("Should not be able to start a new work on a discontinued transaction");
              return null;
            }
          });
          Assert.fail("work against a stopped transaction should fail");
        } catch (Exception ex) {
          // expected
        }
        Assert.assertTrue(txw.isActive(txid2));
        return null;
      }
    });
   
  }
View Full Code Here

  protected TabletServerMinCMetrics mincMetrics = new TabletServerMinCMetrics();

  public TabletServer() {
    super();
    watcher = new TransactionWatcher();

    SimpleTimer.getInstance().schedule(new TimerTask() {
      @Override
      public void run() {
        synchronized (onlineTablets) {
View Full Code Here

    final Logger log = Logger.getLogger(ZombieTServer.class);
    Random random = new Random(System.currentTimeMillis() % 1000);
    int port = random.nextInt(30000) + 2000;
    Instance instance = HdfsZooInstance.getInstance();
   
    TransactionWatcher watcher = new TransactionWatcher();
    final ThriftClientHandler tch = new ThriftClientHandler(instance, watcher);
    Processor<Iface> processor = new Processor<Iface>(tch);
    ServerPort serverPort = TServerUtils.startTServer(port, processor, "ZombieTServer", "walking dead", 2, 1000, 10*1024*1024);
   
    InetSocketAddress addr = new InetSocketAddress(InetAddress.getLocalHost(), serverPort.port);
View Full Code Here

 
  public static void main(String[] args) throws Exception {
    Opts opts = new Opts();
    opts.parseArgs(NullTserver.class.getName(), args);
   
    TransactionWatcher watcher = new TransactionWatcher();
    ThriftClientHandler tch = new ThriftClientHandler(HdfsZooInstance.getInstance(), watcher);
    Processor<Iface> processor = new Processor<Iface>(tch);
    TServerUtils.startTServer(opts.port, processor, "NullTServer", "null tserver", 2, 1000, 10*1024*1024);
   
    InetSocketAddress addr = new InetSocketAddress(InetAddress.getLocalHost(), opts.port);
View Full Code Here

 
  protected TabletServerMinCMetrics mincMetrics = new TabletServerMinCMetrics();
 
  public TabletServer() {
    super();
    watcher = new TransactionWatcher();

    SimpleTimer.getInstance().schedule(new TimerTask() {
      @Override
      public void run() {
        synchronized (onlineTablets) {
View Full Code Here

  @Test
  public void testTransactionWatcher() throws Exception {
    final String txType = "someName";
    final long txid = 7;
    final SimpleArbitrator sa = new SimpleArbitrator();
    final TransactionWatcher txw = new TransactionWatcher(sa);
    sa.start(txType, txid);
    try {
      sa.start(txType, txid);
      Assert.fail("simple arbitrator did not throw an exception");
    } catch (Exception ex) {
      // expected
    }
    txw.isActive(txid);
    Assert.assertFalse(txw.isActive(txid));
    txw.run(txType, txid, new Callable<Object>() {
      @Override
      public Object call() throws Exception {
        Assert.assertTrue(txw.isActive(txid));
        return null;
      }
    });
    Assert.assertFalse(txw.isActive(txid));
    Assert.assertFalse(sa.transactionComplete(txType,  txid));
    sa.stop(txType, txid);
    Assert.assertFalse(sa.transactionAlive(txType, txid));
    Assert.assertFalse(sa.transactionComplete(txType,  txid));
    sa.cleanup(txType, txid);
    Assert.assertTrue(sa.transactionComplete(txType,  txid));
    try {
      txw.run(txType, txid, new Callable<Object>() {
        @Override
        public Object call() throws Exception {
          Assert.fail("Should not be able to start a new work on a discontinued transaction");
          return null;
        }
      });
      Assert.fail("work against stopped transaction should fail");
    } catch (Exception ex) {
      ;
    }
    final long txid2 = 9;
    sa.start(txType, txid2);
    txw.run(txType, txid2, new Callable<Object>() {
      @Override
      public Object call() throws Exception {
        Assert.assertTrue(txw.isActive(txid2));
        sa.stop(txType, txid2);
        try {
          txw.run(txType, txid2, new Callable<Object>() {
            @Override
            public Object call() throws Exception {
              Assert.fail("Should not be able to start a new work on a discontinued transaction");
              return null;
            }
          });
          Assert.fail("work against a stopped transaction should fail");
        } catch (Exception ex) {
          // expected
        }
        Assert.assertTrue(txw.isActive(txid2));
        return null;
      }
    });
   
  }
View Full Code Here

    String iname = args[0];
    String keepers = args[1];
    String tableName = args[2];
    int port = Integer.parseInt(args[3]);
   
    TransactionWatcher watcher = new TransactionWatcher();
    ThriftClientHandler tch = new ThriftClientHandler(watcher);
    TabletClientService.Processor processor = new TabletClientService.Processor(tch);
    TServerUtils.startTServer(port, processor, "NullTServer", "null tserver", 2, 1000);
   
    InetSocketAddress addr = new InetSocketAddress(InetAddress.getLocalHost(), port);
View Full Code Here

  public static void main(String[] args) throws Exception {
    final Logger log = Logger.getLogger(ZombieTServer.class);
    Random random = new Random(System.currentTimeMillis() % 1000);
    int port = random.nextInt(30000) + 2000;
   
    TransactionWatcher watcher = new TransactionWatcher();
    final ThriftClientHandler tch = new ThriftClientHandler(watcher);
    TabletClientService.Processor processor = new TabletClientService.Processor(tch);
    ServerPort serverPort = TServerUtils.startTServer(port, processor, "ZombieTServer", "walking dead", 2, 1000);
   
    InetSocketAddress addr = new InetSocketAddress(InetAddress.getLocalHost(), serverPort.port);
View Full Code Here

TOP

Related Classes of org.apache.accumulo.server.zookeeper.TransactionWatcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.