public static void spinAssertEquals(Object expected, Supplier<Object> s, int timeoutInSeconds) { long now = System.currentTimeMillis(); while (System.currentTimeMillis() - now < now + (1000 * timeoutInSeconds)) { if (s.get().equals(expected)) break; Thread.yield(); } assertEquals(expected, s.get()); }
public static void compact(ColumnFamilyStore cfs, Collection<SSTableReader> sstables) { int gcBefore = cfs.gcBefore(System.currentTimeMillis()); AbstractCompactionTask task = cfs.getCompactionStrategy().getUserDefinedTask(sstables, gcBefore); task.execute(null); }
public static QueryFilter namesQueryFilter( ColumnFamilyStore cfs, DecoratedKey key, CellName... names) { SortedSet<CellName> s = new TreeSet<CellName>(cfs.getComparator()); for (CellName n : names) s.add(n); return QueryFilter.getNamesFilter(key, cfs.name, s, System.currentTimeMillis()); }
public static ColumnFamily getColumnFamily(Keyspace keyspace, DecoratedKey key, String cfName) { ColumnFamilyStore cfStore = keyspace.getColumnFamilyStore(cfName); assert cfStore != null : "Table " + cfName + " has not been defined"; return cfStore.getColumnFamily( QueryFilter.getIdentityFilter(key, cfName, System.currentTimeMillis())); }