File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Daemon problem

 
Sashi Gundoji
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 116
Eclipse IDE Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic