Java Reference
In-Depth Information
Listing 7.11. Encapsulating Nonstandard Cancellation in a
Thread
by Overriding
Interrupt
.
SocketUsingTask
implements
CancellableTask
and defines
Future.cancel
to
close the socket as well as call
super.cancel
. If a
SocketUsingTask
is cancelled
through its
Future
, the socket is closed
and
the executing thread is interrupted. This in-