Author: trustin
Date: Tue Mar 11 21:48:08 2008
New Revision: 636196
URL: http://svn.apache.org/viewvc?rev=636196&view=rev
Log:
Fixed a problem that AbstractIoService.dispose() sometimes hangs because
NotifyingTask.cancel() doesn't work.
Modified:
mina/trunk/core/src/main/java/org/apache/mina/common/IdleStatusChecker.java
Modified:
mina/trunk/core/src/main/java/org/apache/mina/common/IdleStatusChecker.java
URL:
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/IdleStatusChecker.java?rev=636196&r1=636195&r2=636196&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/IdleStatusChecker.java
(original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/IdleStatusChecker.java
Tue Mar 11 21:48:08 2008
@@ -64,6 +64,11 @@
}
public interface NotifyingTask extends Runnable {
+ /**
+ * Cancels this task. Once canceled, [EMAIL PROTECTED] #run()} method
will always return immediately.
+ * To start this task again after calling this method, you have to
create a new instance of
+ * [EMAIL PROTECTED] IdleStatusChecker} again.
+ */
void cancel();
}
@@ -72,7 +77,6 @@
private volatile Thread thread;
public void run() {
- cancelled = false;
thread = Thread.currentThread();
try {
while (!cancelled) {
@@ -93,13 +97,11 @@
}
public void cancel() {
+ cancelled = true;
Thread thread = this.thread;
- if (thread == null) {
- return;
+ if (thread != null) {
+ thread.interrupt();
}
-
- cancelled = true;
- thread.interrupt();
}
private void notifyServices(long currentTime) {