Java Code Examples for org.apache.bookkeeper.proto.BookieServer#suspendProcessing()
The following examples show how to use
org.apache.bookkeeper.proto.BookieServer#suspendProcessing() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestBookKeeperSpeculativeRead.java From hadoop with Apache License 2.0 | 6 votes |
/** * Sleep a bookie until I count down the latch * * @param latch * latch to wait on * @param bookie * bookie server * @throws Exception */ private void sleepBookie(final CountDownLatch latch, final BookieServer bookie) throws Exception { Thread sleeper = new Thread() { public void run() { try { bookie.suspendProcessing(); latch.await(2, TimeUnit.MINUTES); bookie.resumeProcessing(); } catch (Exception e) { LOG.error("Error suspending bookie", e); } } }; sleeper.setName("BookieServerSleeper-" + bookie.getBookie().getId()); sleeper.start(); }
Example 2
Source File: TestBookKeeperJournalManager.java From hadoop with Apache License 2.0 | 6 votes |
/** * Sleep a bookie until I count down the latch * * @param latch * Latch to wait on * @param bookie * bookie server * @throws Exception */ private void sleepBookie(final CountDownLatch l, final BookieServer bookie) throws Exception { Thread sleeper = new Thread() { public void run() { try { bookie.suspendProcessing(); l.await(60, TimeUnit.SECONDS); bookie.resumeProcessing(); } catch (Exception e) { LOG.error("Error suspending bookie", e); } } }; sleeper.setName("BookieServerSleeper-" + bookie.getBookie().getId()); sleeper.start(); }
Example 3
Source File: TestBookKeeperSpeculativeRead.java From big-c with Apache License 2.0 | 6 votes |
/** * Sleep a bookie until I count down the latch * * @param latch * latch to wait on * @param bookie * bookie server * @throws Exception */ private void sleepBookie(final CountDownLatch latch, final BookieServer bookie) throws Exception { Thread sleeper = new Thread() { public void run() { try { bookie.suspendProcessing(); latch.await(2, TimeUnit.MINUTES); bookie.resumeProcessing(); } catch (Exception e) { LOG.error("Error suspending bookie", e); } } }; sleeper.setName("BookieServerSleeper-" + bookie.getBookie().getId()); sleeper.start(); }
Example 4
Source File: TestBookKeeperJournalManager.java From big-c with Apache License 2.0 | 6 votes |
/** * Sleep a bookie until I count down the latch * * @param latch * Latch to wait on * @param bookie * bookie server * @throws Exception */ private void sleepBookie(final CountDownLatch l, final BookieServer bookie) throws Exception { Thread sleeper = new Thread() { public void run() { try { bookie.suspendProcessing(); l.await(60, TimeUnit.SECONDS); bookie.resumeProcessing(); } catch (Exception e) { LOG.error("Error suspending bookie", e); } } }; sleeper.setName("BookieServerSleeper-" + bookie.getBookie().getId()); sleeper.start(); }
Example 5
Source File: BookKeeperClusterTestCase.java From pulsar with Apache License 2.0 | 6 votes |
/** * Sleep a bookie * * @param addr * Socket Address * @param seconds * Sleep seconds * @return Count Down latch which will be counted down when sleep finishes * @throws InterruptedException * @throws IOException */ public CountDownLatch sleepBookie(InetSocketAddress addr, final int seconds) throws Exception { for (final BookieServer bookie : bs) { if (bookie.getLocalAddress().equals(addr)) { final CountDownLatch l = new CountDownLatch(1); Thread sleeper = new Thread() { @Override public void run() { try { bookie.suspendProcessing(); l.countDown(); Thread.sleep(seconds * 1000); bookie.resumeProcessing(); } catch (Exception e) { LOG.error("Error suspending bookie", e); } } }; sleeper.start(); return l; } } throw new IOException("Bookie not found"); }
Example 6
Source File: BookKeeperClusterTestCase.java From pulsar with Apache License 2.0 | 6 votes |
/** * Sleep a bookie until I count down the latch * * @param addr * Socket Address * @param latch * Latch to wait on * @throws InterruptedException * @throws IOException */ public void sleepBookie(InetSocketAddress addr, final CountDownLatch l) throws Exception { for (final BookieServer bookie : bs) { if (bookie.getLocalAddress().equals(addr)) { Thread sleeper = new Thread() { @Override public void run() { try { bookie.suspendProcessing(); l.await(); bookie.resumeProcessing(); } catch (Exception e) { LOG.error("Error suspending bookie", e); } } }; sleeper.start(); return; } } throw new IOException("Bookie not found"); }
Example 7
Source File: ZKTestEnv.java From herddb with Apache License 2.0 | 5 votes |
public void pauseBookie(String addr) throws Exception { for (BookieServer bookie : bookies) { if (bookie.getLocalAddress().getSocketAddress().toString().equals(addr)) { bookie.suspendProcessing(); return; } } throw new Exception("Cannot find bookie " + addr); }