@Override public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e, final Put put, final WALEdit edit, final Durability durability) throws IOException { Threads.sleep(SLEEP_TIME); }
@Override public void run() { Threads.sleep(2000); myThread.interrupt(); } };
@Override public Result preIncrementAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> e, final Increment increment) throws IOException { Threads.sleep(SLEEP_TIME); return null; } }
@Override public void preDelete(final ObserverContext<RegionCoprocessorEnvironment> e, final Delete delete, final WALEdit edit, final Durability durability) throws IOException { Threads.sleep(SLEEP_TIME); }
@Override public Result preIncrement(final ObserverContext<RegionCoprocessorEnvironment> e, final Increment increment) throws IOException { Threads.sleep(SLEEP_TIME); return null; }
@Override public void preDelete(final ObserverContext<RegionCoprocessorEnvironment> e, final Delete delete, final WALEdit edit, final Durability durability) throws IOException { Threads.sleep(SLEEP_TIME); } }
@Override public void preClose(ObserverContext<RegionCoprocessorEnvironment> c, boolean abortRequested) throws IOException { Threads.sleep(SLEEP_TIME_WHEN_CLOSE_REGION); } }
@Override public Result postAppend(final ObserverContext<RegionCoprocessorEnvironment> e, final Append append, final Result result) throws IOException { if (ct.incrementAndGet() == 1) { Threads.sleep(sleepTime.get()); } return result; } }
@Override public void preGetNamespaceDescriptor(ObserverContext<MasterCoprocessorEnvironment> ctx, String namespace) throws IOException { Threads.sleep(DEFAULT_RPC_TIMEOUT / 2); if (sleepTime.addAndGet(DEFAULT_RPC_TIMEOUT / 2) < DEFAULT_OPERATION_TIMEOUT) { throw new IOException("call fail"); } } }
@Override public Result postIncrement(final ObserverContext<RegionCoprocessorEnvironment> e, final Increment increment, final Result result) throws IOException { if (ct.incrementAndGet() == 1) { Threads.sleep(sleepTime.get()); } return result; }
@Override public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e, final Put put, final WALEdit edit, final Durability durability) throws IOException { Threads.sleep(sleepTime.get()); if (ct.incrementAndGet() == 1) { throw new IOException("first call I fail"); } }
@Override public void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> e, final Get get, final List<Cell> results) throws IOException { Threads.sleep(sleepTime.get()); if (ct.incrementAndGet() == 1) { throw new IOException("first call I fail"); } }
@Override public void preDelete(final ObserverContext<RegionCoprocessorEnvironment> e, final Delete delete, final WALEdit edit, final Durability durability) throws IOException { Threads.sleep(sleepTime.get()); if (ct.incrementAndGet() == 1) { throw new IOException("first call I fail"); } }
@Override public Result preIncrement(final ObserverContext<RegionCoprocessorEnvironment> e, final Increment increment) throws IOException { Threads.sleep(sleepTime.get()); if (ct.incrementAndGet() == 1) { throw new IOException("first call I fail"); } return null; }
private Set<String> readJmxMetricsWithRetry() throws IOException { final int count = 0; for (int i = 0; i < 10; i++) { Set<String> metrics = readJmxMetrics(); if (metrics != null) { return metrics; } LOG.warn("Failed to get jmxmetrics... sleeping, retrying; " + i + " of " + count + " times"); Threads.sleep(1000); } return null; }
private void waitAndAssertTimestamp(TestLockProcedure proc, int size, int lastTs) { final ArrayList<Long> timestamps = proc.getTimestamps(); while (timestamps.size() < size) Threads.sleep(10); LOG.info(proc + " -> " + timestamps); assertEquals(size, timestamps.size()); if (size > 0) { assertEquals(lastTs, timestamps.get(timestamps.size() - 1).longValue()); } }
private void executeFlush(HRegion region) throws IOException { // retry 5 times if we can not flush for (int i = 0; i < 5; i++) { FlushResult result = region.flush(true); if (result.getResult() != FlushResult.Result.CANNOT_FLUSH) { return; } Threads.sleep(1000); } }
private void modifyTableSync(Admin admin, TableName tableName, HTableDescriptor htd) throws IOException { admin.modifyTable(tableName, htd); //wait until modify table finishes for (int t = 0; t < 100; t++) { //10 sec timeout HTableDescriptor td = admin.getTableDescriptor(htd.getTableName()); if (td.equals(htd)) { break; } Threads.sleep(100); } }
public static void waitForRegionToBeInTransition(final HBaseTestingUtility util, final RegionInfo hri) throws Exception { while (!getMaster(util).getAssignmentManager().getRegionStates().isRegionInTransition(hri)) { Threads.sleep(10); } }