• Post Reply Bookmark Topic Watch Topic
  • New Topic

threads pipes and objects  RSS feed

 
Mohammed Fayaz
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Iam new to java threads.

1. Can I connect ObjectXputStreams to Pipes?

2. Why will one get IOExcetipn : "Write end dead"?

As in "first thread reads words from , prepares s (My own object) and writes to a pipe. The second thread reads these s from this pipe and prepares a text file".

Also I am planning to have an intermediate thread which will read first thread's pipe, filter out white spaces and write remining s to the second thread's pipe.

I got the code which will
1. Open a file, parse the words, prepare s
2. Identify which s are white spaces
3. Prepare a test file from s
 
Henry Wong
author
Sheriff
Posts: 22852
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2. Why will one get IOExcetipn : "Write end dead"?


When a thread first read from or write to the pipe, the thread object (for the thread using the pipe) is saved.

Later, when you try to write to a pipe, or read from a pipe (and there is nothing to read), it will check on the status of the thread on the other end. If that thread is no longer active, you get an "end dead"... meaning the other side is dead.

Now, it is possible to recover from this. For example, if the read side is dead, and a new thread reads from the pipe, this new thread object will be saved. On the write side, if you know that a new read thread will be running, you merely have to catch the exception, and try again...

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!