Wednesday, 21 August 2013

Web dinamic project, Instance the same instance

Web dinamic project, Instance the same instance

I'm working on a web project, I have a class named Connection, this class
establishes a connection via TCP/IP with another device, When there is a
http get request I instance an object "connection_o" and start a thread to
keep the communication up like this: "connection_o.start" so the
connection is established, in the next http request I must send a message,
but when I execute again the "doGet" in order to avoid the nullpointer
exception I need to instance the object again , but I can't because I need
to use the same instance that I used before that is running, in my tests,
the connection keeps working but I´m unable to access to the thread I
already created. So I need some kind of static class or a way to use the
thread that is already running.
Thanks in advance

No comments:

Post a Comment