public void markNumResultsNotDeleted(int resultsInBatch) { numNotDeleted += resultsInBatch; AssertUtils.assertAndLog(log, numNotDeleted <= numReturned, "NotDeleted is bigger than the number of results we returned."); }
/** * @deprecated Use {@link #assertAndLogWithException(Logger, boolean, String, Throwable)} instead. * This will make sure log events go to your logger instead of a hard-to-filter default. * (com.palantir.util.AssertUtils) */ @Deprecated public static void assertAndLogWithException(boolean cheapTest, String msg, Throwable t) { assertAndLogWithException(defaultLog, cheapTest, msg, t); }
public static void assertAndLog(Logger log, boolean cheapTest, String msg) { if (!cheapTest) { assertAndLogWithException(log, false, msg, getDebuggingException()); } }
public static void assertAndLog(Logger log, boolean cheapTest, String format, Object... args) { if (!cheapTest) { assertAndLog(log, false, String.format(format, args)); } }
public static void assertAndLogWithException(Logger log, boolean cheapTest, String format, Throwable t, Object... args) { if (!cheapTest) { assertAndLogWithException(log, false, String.format(format, args), t); } }
public static void assertAndLog(Logger log, boolean cheapTest, String msg) { if (!cheapTest) { assertAndLogWithException(log, false, msg, getDebuggingException()); } }
/** * @deprecated Use {@link #assertAndLog(Logger, boolean, String, Object...)} instead. * This will make sure log events go to your logger instead of a hard-to-filter default. * (com.palantir.util.AssertUtils) */ @Deprecated public static void assertAndLog(boolean cheapTest, String format, Object... args) { assertAndLog(defaultLog, cheapTest, format, args); }
/** * @deprecated Use {@link #assertAndLogWithException(Logger, boolean, String, Throwable, Object...)} instead. * This will make sure log events go to your logger instead of a hard-to-filter default. * (com.palantir.util.AssertUtils) */ @Deprecated public static void assertAndLogWithException(boolean cheapTest, String format, Throwable t, Object... args) { assertAndLogWithException(defaultLog, cheapTest, format, t, args); }
@SuppressWarnings("ValidateConstantMessage") private void fail(String message) { switch (strictness) { case ASSERT_AND_LOG: AssertUtils.assertAndLog(log, false, message); break; case VALIDATE: Validate.isTrue(false, message); break; } }
@Override public void finalize() throws Throwable { try { if (!hasBeenClosed) { close(); AssertUtils.assertAndLogWithException(log, false, String.format( "This AgnosticLightResultSet is being finalized, but it has not been closed. " + //$NON-NLS-1$ "This is a programming error and can lead to cursor leaks. Thread: %s", creationThreadName), //$NON-NLS-1$ creationLocation); } } finally { super.finalize(); } }
/** * @deprecated Use {@link #assertAndLog(Logger, boolean, String)} instead. * This will make sure log events go to your logger instead of a hard-to-filter default. * (com.palantir.util.AssertUtils) */ @Deprecated public static void assertAndLog(boolean cheapTest, String msg) { assertAndLog(defaultLog, cheapTest, msg); }
/** * @deprecated Use {@link #assertAndLogWithException(Logger, boolean, String, Throwable, Object...)} instead. * This will make sure log events go to your logger instead of a hard-to-filter default. * (com.palantir.util.AssertUtils) */ @Deprecated public static void assertAndLogWithException(boolean cheapTest, String format, Throwable t, Object... args) { assertAndLogWithException(defaultLog, cheapTest, format, t, args); }
private Multimap<TableReference, Cell> getCellsToScrubByTable(State expectedState) { Multimap<TableReference, Cell> tableRefToCells = HashMultimap.create(); State actualState = state.get(); if (expectedState == actualState) { for (Entry<TableReference, ConcurrentNavigableMap<Cell, byte[]>> entry : writesByTable.entrySet()) { TableReference table = entry.getKey(); Set<Cell> cells = entry.getValue().keySet(); tableRefToCells.putAll(table, cells); } } else { AssertUtils.assertAndLog(log, false, "Expected state: " + expectedState + "; actual state: " + actualState); } return tableRefToCells; }
/** * @deprecated Use {@link #assertAndLogWithException(Logger, boolean, String, Throwable)} instead. * This will make sure log events go to your logger instead of a hard-to-filter default. * (com.palantir.util.AssertUtils) */ @Deprecated public static void assertAndLogWithException(boolean cheapTest, String msg, Throwable t) { assertAndLogWithException(defaultLog, cheapTest, msg, t); }
private Multimap<Cell, TableReference> getCellsToScrubByCell(State expectedState) { Multimap<Cell, TableReference> cellToTableName = HashMultimap.create(); State actualState = state.get(); if (expectedState == actualState) { for (Entry<TableReference, ConcurrentNavigableMap<Cell, byte[]>> entry : writesByTable.entrySet()) { TableReference table = entry.getKey(); Set<Cell> cells = entry.getValue().keySet(); for (Cell c : cells) { cellToTableName.put(c, table); } } } else { AssertUtils.assertAndLog(log, false, "Expected state: " + expectedState + "; actual state: " + actualState); } return cellToTableName; }
public static void assertAndLogWithException(Logger log, boolean cheapTest, String format, Throwable t, Object... args) { if (!cheapTest) { assertAndLogWithException(log, false, String.format(format, args), t); } }
private void validateRowNames(Iterable<byte[]> rows, byte[] startInclusive, byte[] endExclusive, boolean reverse) { for (byte[] row : rows) { if (reverse) { AssertUtils.assertAndLog(log, startInclusive.length == 0 || UnsignedBytes.lexicographicalComparator().compare(startInclusive, row) >= 0, "row was out of range"); AssertUtils.assertAndLog(log, endExclusive.length == 0 || UnsignedBytes.lexicographicalComparator().compare(row, endExclusive) > 0, "row was out of range"); } else { AssertUtils.assertAndLog(log, startInclusive.length == 0 || UnsignedBytes.lexicographicalComparator().compare(startInclusive, row) <= 0, "row was out of range"); AssertUtils.assertAndLog(log, endExclusive.length == 0 || UnsignedBytes.lexicographicalComparator().compare(row, endExclusive) < 0, "row was out of range"); } } }
@Override public void finalize() throws Throwable { try { if (!hasBeenClosed) { close(); AssertUtils.assertAndLogWithException(log, false, String.format( "This AgnosticLightResultSet is being finalized, but it has not been closed. " + //$NON-NLS-1$ "This is a programming error and can lead to cursor leaks. Thread: %s", creationThreadName), //$NON-NLS-1$ creationLocation); } } finally { super.finalize(); } }
@Override public Collection<SqlCallStats> stop() { if (currentTrace.get() == null) { AssertUtils.assertAndLog(log, false, "Tracing already stopped."); return ImmutableList.of(); } Collection<SqlCallStats> result = ImmutableList.copyOf(currentTrace.get().values()); currentTrace.remove(); return result; } }
@Override public void start() { if (currentTrace.get() != null) { AssertUtils.assertAndLog(log, false, "Tracing already started."); return; } currentTrace.set(Maps.<String, SqlCallStats> newConcurrentMap()); }