mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-07 07:40:55 +03:00
exceptions raised by Future / Event can be Throwable instances as earlier, instead of Exception
This commit is contained in:
@@ -31,7 +31,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*
|
||||
* @see Future
|
||||
*/
|
||||
public class Event<T extends Exception>
|
||||
public class Event<T extends Throwable>
|
||||
extends Future<Boolean, T> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
* For atomic operations on a future, e.g. checking if a value is set and if it is not then setting it - in other words,
|
||||
* Compare-And-Set type operations - the associated lock for the future should be acquired while doing so.
|
||||
*/
|
||||
public class Future<V, T extends Exception> {
|
||||
public class Future<V, T extends Throwable> {
|
||||
|
||||
private final Logger log;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class Future<V, T extends Exception> {
|
||||
*
|
||||
* @param e the error
|
||||
*/
|
||||
public void error(Exception e) {
|
||||
public void error(Throwable e) {
|
||||
lock();
|
||||
try {
|
||||
pendingEx = chainer.chain(e);
|
||||
|
||||
@@ -19,12 +19,12 @@ import java.util.Collection;
|
||||
|
||||
public class FutureUtils {
|
||||
|
||||
public static void alertAll(Exception x, Future... futures) {
|
||||
public static void alertAll(Throwable x, Future... futures) {
|
||||
for (Future f : futures)
|
||||
f.error(x);
|
||||
}
|
||||
|
||||
public static void alertAll(Exception x, Collection<? extends Future> futures) {
|
||||
public static void alertAll(Throwable x, Collection<? extends Future> futures) {
|
||||
for (Future f : futures)
|
||||
f.error(x);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user