/** * Defers to the delegate and calls the * {@link EnvironmentEdge#currentTime()} method. * * @return current time in millis according to the delegate. */ public static long currentTime() { return getDelegate().currentTime(); } }
private void waitForRegion() throws InterruptedIOException { if (busyRegions.isEmpty()) { return; } EnvironmentEdge ee = EnvironmentEdgeManager.getDelegate(); final long start = ee.currentTime(); while ((ee.currentTime() - start) <= MAX_WAITING_TIME) { for (byte[] region : busyRegions) { AtomicInteger count = taskCounterPerRegion.get(region); if (count == null || count.get() < maxConcurrentTasksPerRegion) { return; } } try { synchronized (tasksInProgress) { tasksInProgress.wait(10); } } catch (InterruptedException e) { throw new InterruptedIOException("Interrupted." + " tasksInProgress=" + tasksInProgress); } } }
@Test public void testManageSingleton() { EnvironmentEdgeManager.reset(); EnvironmentEdge edge = EnvironmentEdgeManager.getDelegate(); assertNotNull(edge); assertTrue(edge instanceof DefaultEnvironmentEdge); EnvironmentEdgeManager.reset(); EnvironmentEdge edge2 = EnvironmentEdgeManager.getDelegate(); assertFalse(edge == edge2); IncrementingEnvironmentEdge newEdge = new IncrementingEnvironmentEdge(); EnvironmentEdgeManager.injectEdge(newEdge); assertEquals(newEdge, EnvironmentEdgeManager.getDelegate()); //injecting null will result in default being assigned. EnvironmentEdgeManager.injectEdge(null); EnvironmentEdge nullResult = EnvironmentEdgeManager.getDelegate(); assertTrue(nullResult instanceof DefaultEnvironmentEdge); }
@Test public void testHFileCleaning() throws Exception { final EnvironmentEdge originalEdge = EnvironmentEdgeManager.getDelegate(); String prefix = "someHFileThatWouldBeAUUID"; Configuration conf = UTIL.getConfiguration();
private HStore prepareData() throws IOException { Admin admin = TEST_UTIL.getAdmin(); TableDescriptor desc = TableDescriptorBuilder.newBuilder(tableName) .setValue(DefaultStoreEngine.DEFAULT_COMPACTION_POLICY_CLASS_KEY, FIFOCompactionPolicy.class.getName()) .setValue(HConstants.HBASE_REGION_SPLIT_POLICY_KEY, DisabledRegionSplitPolicy.class.getName()) .setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(family).setTimeToLive(1).build()) .build(); admin.createTable(desc); Table table = TEST_UTIL.getConnection().getTable(tableName); TimeOffsetEnvironmentEdge edge = (TimeOffsetEnvironmentEdge) EnvironmentEdgeManager.getDelegate(); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { byte[] value = new byte[128 * 1024]; ThreadLocalRandom.current().nextBytes(value); table.put(new Put(Bytes.toBytes(i * 10 + j)).addColumn(family, qualifier, value)); } admin.flush(tableName); edge.increment(1001); } return getStoreWithName(tableName); }
EnvironmentEdgeManager.getDelegate(), wal, scopes, mvcc);
HRegion region = HRegion.openHRegion(TEST_UTIL.getConfiguration(), TEST_UTIL.getTestFileSystem(), TEST_UTIL.getDefaultRootDirPath(), hri, htd, wal); EnvironmentEdge ee = EnvironmentEdgeManager.getDelegate(); try { List<Put> puts = null;
private void waitForRegion() throws InterruptedIOException { if (busyRegions.isEmpty()) { return; } EnvironmentEdge ee = EnvironmentEdgeManager.getDelegate(); final long start = ee.currentTime(); while ((ee.currentTime() - start) <= MAX_WAITING_TIME) { for (byte[] region : busyRegions) { AtomicInteger count = taskCounterPerRegion.get(region); if (count == null || count.get() < maxConcurrentTasksPerRegion) { return; } } try { synchronized (tasksInProgress) { tasksInProgress.wait(10); } } catch (InterruptedException e) { throw new InterruptedIOException("Interrupted." + " tasksInProgress=" + tasksInProgress); } } }
/** * Defers to the delegate and calls the * {@link EnvironmentEdge#currentTime()} method. * * @return current time in millis according to the delegate. */ public static long currentTime() { return getDelegate().currentTime(); } }
/** * Defers to the delegate and calls the * {@link EnvironmentEdge#currentTimeMillis()} method. * * @return current time in millis according to the delegate. */ public static long currentTimeMillis() { return getDelegate().currentTimeMillis(); } }
/** * Defers to the delegate and calls the * {@link EnvironmentEdge#currentTime()} method. * * @return current time in millis according to the delegate. */ public static long currentTime() { return getDelegate().currentTime(); } }
/** * Defers to the delegate and calls the * {@link EnvironmentEdge#currentTime()} method. * * @return current time in millis according to the delegate. */ public static long currentTime() { return getDelegate().currentTime(); } }
private void waitForRegion() throws InterruptedIOException { if (busyRegions.isEmpty()) { return; } EnvironmentEdge ee = EnvironmentEdgeManager.getDelegate(); final long start = ee.currentTime(); while ((ee.currentTime() - start) <= MAX_WAITING_TIME) { for (byte[] region : busyRegions) { AtomicInteger count = taskCounterPerRegion.get(region); if (count == null || count.get() < maxConcurrentTasksPerRegion) { return; } } try { synchronized (tasksInProgress) { tasksInProgress.wait(10); } } catch (InterruptedException e) { throw new InterruptedIOException("Interrupted." + " tasksInProgress=" + tasksInProgress); } } }
@Test public void testManageSingleton() { EnvironmentEdgeManager.reset(); EnvironmentEdge edge = EnvironmentEdgeManager.getDelegate(); assertNotNull(edge); assertTrue(edge instanceof DefaultEnvironmentEdge); EnvironmentEdgeManager.reset(); EnvironmentEdge edge2 = EnvironmentEdgeManager.getDelegate(); assertFalse(edge == edge2); IncrementingEnvironmentEdge newEdge = new IncrementingEnvironmentEdge(); EnvironmentEdgeManager.injectEdge(newEdge); assertEquals(newEdge, EnvironmentEdgeManager.getDelegate()); //injecting null will result in default being assigned. EnvironmentEdgeManager.injectEdge(null); EnvironmentEdge nullResult = EnvironmentEdgeManager.getDelegate(); assertTrue(nullResult instanceof DefaultEnvironmentEdge); }
@Test public void testManageSingleton() { EnvironmentEdgeManager.reset(); EnvironmentEdge edge = EnvironmentEdgeManager.getDelegate(); assertNotNull(edge); assertTrue(edge instanceof DefaultEnvironmentEdge); EnvironmentEdgeManager.reset(); EnvironmentEdge edge2 = EnvironmentEdgeManager.getDelegate(); assertFalse(edge == edge2); IncrementingEnvironmentEdge newEdge = new IncrementingEnvironmentEdge(); EnvironmentEdgeManager.injectEdge(newEdge); assertEquals(newEdge, EnvironmentEdgeManager.getDelegate()); //injecting null will result in default being assigned. EnvironmentEdgeManager.injectEdge(null); EnvironmentEdge nullResult = EnvironmentEdgeManager.getDelegate(); assertTrue(nullResult instanceof DefaultEnvironmentEdge); }
@Test public void testHFileCleaning() throws Exception { final EnvironmentEdge originalEdge = EnvironmentEdgeManager.getDelegate(); String prefix = "someHFileThatWouldBeAUUID"; Configuration conf = UTIL.getConfiguration();
private HStore prepareData() throws IOException { Admin admin = TEST_UTIL.getAdmin(); TableDescriptor desc = TableDescriptorBuilder.newBuilder(tableName) .setValue(DefaultStoreEngine.DEFAULT_COMPACTION_POLICY_CLASS_KEY, FIFOCompactionPolicy.class.getName()) .setValue(HConstants.HBASE_REGION_SPLIT_POLICY_KEY, DisabledRegionSplitPolicy.class.getName()) .setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(family).setTimeToLive(1).build()) .build(); admin.createTable(desc); Table table = TEST_UTIL.getConnection().getTable(tableName); TimeOffsetEnvironmentEdge edge = (TimeOffsetEnvironmentEdge) EnvironmentEdgeManager.getDelegate(); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { byte[] value = new byte[128 * 1024]; ThreadLocalRandom.current().nextBytes(value); table.put(new Put(Bytes.toBytes(i * 10 + j)).addColumn(family, qualifier, value)); } admin.flush(tableName); edge.increment(1001); } return getStoreWithName(tableName); }
EnvironmentEdgeManager.getDelegate(), wal, scopes, mvcc);
HRegion region = HRegion.openHRegion(TEST_UTIL.getConfiguration(), TEST_UTIL.getTestFileSystem(), TEST_UTIL.getDefaultRootDirPath(), hri, htd, wal); EnvironmentEdge ee = EnvironmentEdgeManager.getDelegate(); try { List<Put> puts = null;