exceptions raised by Future / Event can be Throwable instances as earlier, instead of Exception

This commit is contained in:
Shikhar Bhushan
2010-03-06 01:22:09 +01:00
parent 95ea040768
commit 009c58e67b
3 changed files with 5 additions and 5 deletions

View File

@@ -31,7 +31,7 @@ import java.util.concurrent.locks.ReentrantLock;
* *
* @see Future * @see Future
*/ */
public class Event<T extends Exception> public class Event<T extends Throwable>
extends Future<Boolean, T> { extends Future<Boolean, T> {
/** /**

View File

@@ -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, * 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. * 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; private final Logger log;
@@ -88,7 +88,7 @@ public class Future<V, T extends Exception> {
* *
* @param e the error * @param e the error
*/ */
public void error(Exception e) { public void error(Throwable e) {
lock(); lock();
try { try {
pendingEx = chainer.chain(e); pendingEx = chainer.chain(e);

View File

@@ -19,12 +19,12 @@ import java.util.Collection;
public class FutureUtils { public class FutureUtils {
public static void alertAll(Exception x, Future... futures) { public static void alertAll(Throwable x, Future... futures) {
for (Future f : futures) for (Future f : futures)
f.error(x); 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) for (Future f : futures)
f.error(x); f.error(x);
} }