Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help me to implement a function "Cancel" to terminate a Thread  RSS feed

Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I developped a application en MIDP1.0/CLDC 1.0.
I need to implement a function "Cancel" to interrupt a thread.
It aim to interrupt a connection.

Here my code:

Connection implements Runnable, CommandListener{
private CommandThread ;
public void run(){
//conn =;
public interrupt(){
synchronized (this) {
CommandThread = null;
conn = null;


public void commandAction(Command c, Displayable d){
commandThread = new Thread(this);


But it doesn't work. But in CLDC1.1 there is soution to interrupt a thread.

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!