aspose file tools*
The moose likes Java in General and the fly likes Daemon problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Daemon problem" Watch "Daemon problem" New topic
Author

Daemon problem

Sashi Gundoji
Greenhorn

Joined: Jan 30, 2007
Posts: 10
Hallo,
I am new to Java and I am programming with multiple daemons are running parallel. I have one problem. i used each daemon with synchronization.master daemon is always waiting for data from slave daemons.

master daemon {
synchronized (datareceived) {
while(processrunning) {
datareceived.wait();
do some process with data
}
}

slave daemon1 {
synchronized (datareceived) {
while(processrunning) {
ReadData;
datareceived.notify();
}
}

slave daemon2 {
synchronized (datareceived) {
while(processrunning) {
ReadData;
datareceived.notify();
}
}


The problem is if master daemon is not at the position of wait and if one of slave did send notify(), then i am loosing the notification.

What I want is, i should not loose any notification. I should respond on each notification. So please let me know if somebody can help regarding

Thank you,

Regards,
Dimpu
Chris Beckey
Ranch Hand

Joined: Jun 09, 2006
Posts: 116

It looks like you need to queue the results and then let the master thread pick elements off the queue as they become available. If you are running Java 1.5 or later take a look at java.util.concurrent.BlockingQueue. If you are running 1.4 or earlier you'll have to implement something similar yourself.
Sashi Gundoji
Greenhorn

Joined: Jan 30, 2007
Posts: 10
Thank you for your message. I am using lesser version of JDK. I am not able to look into java code even in JDK1.5.

Eclipse is showing below message:
Source not found
The jar file rt.jar has no source attachment.
You can attach the source by clicking Attach Source below

I tried to locate rt.jar, but still that does not help me. So could you please tell me how I can see the source code.

thanks,

Regards,
Sashi
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14347
    
  22

That Eclipse error message means that you were trying to look at the source code of the standard Java API classes. Did you do what Eclipse suggested to you: "You can attach the source by clicking Attach Source below"?

You have a file src.zip in your JDK directory which contains the source code of the standard Java classes. You can tell Eclipse where that src.zip file is, so that it can show you the source code.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Daemon problem