java - Should i nullify an interrupted thread? -
i created thread this:
private thread t = new thread() { @override public void run() { try { while(true) { // work thread.sleep(1000); } } catch (interruptedexception ex) { } } }; t.start();
then interrupted using t.interrupt()
.
as thread stops , on sleep() interrupt , become unusable, stay on memory?
do have call t = null
, or gc take care of that?
i'm trying dynamically interrupt thread , recreate when needed (using t = new thread()
), im not sure if interrupt() removes old thread memory. i've searched couldn't find specfic answer.
the thread class proxy os thread. before call start() there no actual os thread , after thread stops cleaned if hold on thread object. @ point other object , cleaned in normal way.
Comments
Post a Comment