This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes daemon that access fields on the object where it is created Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "daemon that access fields on the object where it is created" Watch "daemon that access fields on the object where it is created" New topic
Author

daemon that access fields on the object where it is created

Fabricio Zelada
Greenhorn

Joined: Dec 28, 2011
Posts: 7

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
Sheriff

Joined: Sep 28, 2004
Posts: 18546
    
  40

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

Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: daemon that access fields on the object where it is created
 
Similar Threads
Creating a class within JSP to be shared among pages
daemon Vs User Thread
thread
creating objects from xml
When does the JVM Exit?