io.deephaven.engine.table.impl.util.AsyncClientErrorNotifier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-engine-table Show documentation
Show all versions of deephaven-engine-table Show documentation
Engine Table: Implementation and closely-coupled utilities
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.engine.table.impl.util;
import io.deephaven.engine.table.impl.UpdateErrorReporter;
import io.deephaven.util.datastructures.WeakIdentityHashSet;
import java.io.IOException;
/**
* When we get an error from a table in the listener tree, we want to send an appropriate command to the clients
* indicating that something has gone wrong with the table.
*/
public class AsyncClientErrorNotifier {
private static volatile UpdateErrorReporter reporter = null;
private static final WeakIdentityHashSet knownErrors = new WeakIdentityHashSet.Synchronized<>();
public static UpdateErrorReporter setReporter(UpdateErrorReporter reporter) {
final UpdateErrorReporter old = AsyncClientErrorNotifier.reporter;
AsyncClientErrorNotifier.reporter = reporter;
return old;
}
public static void reportError(Throwable t) throws IOException {
final UpdateErrorReporter localReporter = reporter;
if (localReporter != null && knownErrors.add(t)) {
localReporter.reportUpdateError(t);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy