--- a/src/share/classes/java/lang/UnmatchedTransfer.java Sat Jul 26 22:59:05 2008 -0700
+++ b/src/share/classes/java/lang/UnmatchedTransfer.java Sun Jul 27 17:16:44 2008 -0700
@@ -37,8 +37,15 @@ public class UnmatchedTransfer extends R
private final Jump jump;
public UnmatchedTransfer(Jump jump) {
+ super(jump.thread() == null
+ ? "late transfer"
+ : "transfer in wrong thread",
+ jump);
this.jump = jump;
+ if (jump.thread() == Thread.currentThread())
+ throw new IllegalStateException(this);
}
+
/**
* Returns the thread in which the transfer target is executing.
*/
@@ -47,7 +54,8 @@ public class UnmatchedTransfer extends R
}
/**
- * Cause the transfer to occur.
+ * Return the exception to be thrown to cause the transfer to
+ * occur.
*/
public RuntimeException transfer() {
return jump.transfer();