L
Linus
Im programming for a mobile phone (though this is not a J2ME question)
and basically I cant make a blocking call (such as opening a connection)
from an CommandListener because it causes deadlock.
So i created a new class that extends Thread that opens a connection, in
the constructor it takes the class that created it (i think its whats
called a call back) so that when it has created the connection it gives
back the data streams to the original class.
Should I continue execution from the call back method invoked by the
connection creator, or should I poll to see when the data streams are !=
null.
The latter seems pointless in situation where im trying to avoid
blocking. Im not quite sure how the garbage collector works but
basically after the call back has been made i dont need the connection
creater object any more so will it be destroyed? Or because thats the
thread thats running will it be kept alive, anyway im a bit confused
about how this all works so if someone could give me some pointers that
would be great.
HoboZilla
and basically I cant make a blocking call (such as opening a connection)
from an CommandListener because it causes deadlock.
So i created a new class that extends Thread that opens a connection, in
the constructor it takes the class that created it (i think its whats
called a call back) so that when it has created the connection it gives
back the data streams to the original class.
Should I continue execution from the call back method invoked by the
connection creator, or should I poll to see when the data streams are !=
null.
The latter seems pointless in situation where im trying to avoid
blocking. Im not quite sure how the garbage collector works but
basically after the call back has been made i dont need the connection
creater object any more so will it be destroyed? Or because thats the
thread thats running will it be kept alive, anyway im a bit confused
about how this all works so if someone could give me some pointers that
would be great.
HoboZilla