Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

daemon that access fields on the object where it is created

 
Fabricio Zelada
Greenhorn
Posts: 7
Java Netscape Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am creating a deamon that runs in paralel with the main application, it is created almost as soon as my app starts. I want it to check some data on the application and take some actions according this data.
I tried to create a class that cointains the deamon, but then I have no idea how to access the data in the main application. Also I thought to use a nested class, but I had some problems creating the deamon because I cannot create it from the application it self.
Some help Please!!
And happy new year!
 
Henry Wong
author
Marshal
Pie
Posts: 20907
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fabricio Zelada wrote:Hello,
I am creating a deamon that runs in paralel with the main application, it is created almost as soon as my app starts. I want it to check some data on the application and take some actions according this data.
I tried to create a class that cointains the deamon, but then I have no idea how to access the data in the main application. Also I thought to use a nested class, but I had some problems creating the deamon because I cannot create it from the application it self.
Some help Please!!



I can't quite figure out what you are asking here. Basically, I can't figure out if you are talking about two different programs or two different threads in the same program.

If the first, meaning two different programs, threads won't help you here. You will need some way to cooperatively communicate between the two programs, albeit with shared files, with a network connection, or some kind of share services (such as a database). It doesn't matter. You will need to implement the communication.

If the second, meaning two different threads in the same program, threads doesn't do magic here. It doesn't matter how you do it, but you are responsible for make sure both threads share the data, and synchronize the data, cooperatively.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic