• Post Reply Bookmark Topic Watch Topic
  • New Topic

Inter-Thread Communication. How to detect if one side is missing?

 
Daniel B. Davis
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this is the wrong forum -- sometimes its difficult to tell. I didn't notice a specific forum for inter-thread communication. Please forgive and move this to the correct place.

As part of inter-thread I/O for something I am doing, I have developed a working model of the I/O needed, attached. It uses PipedWriters and PipedReaders for bidirectional communication for two entities which I've named SideA and SideB in the model. The thing is, while SideA will always be present, SideB may not always be. SideB can be used independently, while SideA cannot be. Is there a way for SideB to tell if SideA is present using only the piping setup? Or must I use other ways for this?

A related question is that the Timeout has never worked, and I have not been able to make it. (Perhaps, instead I might use timers.) If it did, then sideB might use timeout and lack of response (the pipes block) to infer that sideA is missing. While there are plenty of ways to add other arrangements, doing it based upon the communication mechanism seems somehow more elegant.

Thanks, as always.

After trying to send a zip file for convenience, and got stopped by the website, I wonder: Often with my mailer I send a .zip file as .data, with instructions to rename. Is something like that welcomed here? I do not want to overstep, but sending zip can be a convenience. Not obviously for something small like this, but for larger things. Could it not be scanned for difficulties before execution? After that, I found I was also not permitted to send .txt files. Not knowing how you want files sent, I have tried 2 ways.

The file with extension .data is actually a .zip file containing only the src directory from eclipse. The file with extension .x is actually a text file containing all Java source, well-marked. Each contains only source for the 7 tiny files. Since the Attachment tab shows only the last file I attached, though it says I may attach 3, and the Firefox Windows File Chooser allows only single selection, I don't know what is going on. I would appreciate some words about how I might legitimately send 7 or more tiny source programs in three files. Should I copy them bodily into the text of the posting? Having written that, source is below:


File SideA.java
-----------------
File SideASender.java
-------------------------

File SideAReceiver.java
---------------------------

File SideB.java
-----------------

File SideBSender.java
-------------------------

File SideBReceiver.java
---------------------------


File Timeout.java
-------------------
 
Tony Docherty
Saloon Keeper
Posts: 3138
72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags (← click) when posting code as it makes it easier for people to read your code. I've added them for you this time.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!