and only 1 out if 15 threads was terminated. Why?
Is it a better idea to solve my task such a way?
public void stopInteraction() {
Log.i(Constants.LOG_TAG, "Stop threads: ServerInteraction::stopInteraction()");
isCancelling = true;
mPoolThreads.shutdown(); // Disable new tasks from being submitted
boolean isTerminated = mPoolThreads.isTerminated();
while (!isTerminated) {
mPoolThreads.shutdownNow();
isTerminated = mPoolThreads.isTerminated();
Log.i(Constants.LOG_TAG, "Stop threads: the threads are not terminated yet");
}
Log.w(Constants.LOG_TAG, "Stop threads: Terminated");
if (mLoadHandler != null) {
mLoadHandler.onDataLoadCancelled();
}
if (mSendHandler != null) {
mSendHandler.onDataSendCancelled();
}
}
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment