W
Wisdo
Hi ALL,
I write a Listener class, and let the Thread obj
as member variable, when initilize and destroy
call corresponding thread method.
have it some implicit problem ?
whether i need add synchronized keyword into
some places?
please give your salted suggestion.
-------- code begin ----------------------
public Listener extends Runnable {
private Thread th;
public void initilize() {
th = new Thread(this);
th.setName(getClass().getName());
th.setDaemon(true);
th.start();
}
public void run() {
//listen evnet and perform operation
}
public void destry() {
th.stop();
}
}
---------- code end --------------------
Thanks
-Wisdo
I write a Listener class, and let the Thread obj
as member variable, when initilize and destroy
call corresponding thread method.
have it some implicit problem ?
whether i need add synchronized keyword into
some places?
please give your salted suggestion.
-------- code begin ----------------------
public Listener extends Runnable {
private Thread th;
public void initilize() {
th = new Thread(this);
th.setName(getClass().getName());
th.setDaemon(true);
th.start();
}
public void run() {
//listen evnet and perform operation
}
public void destry() {
th.stop();
}
}
---------- code end --------------------
Thanks
-Wisdo