Produce & Consumer problems...
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   marco_baroetto
Posted On:   Thursday, September 5, 2002 12:43 AM

I have 2 threads, Producer and Consumer. Producer writes on a PipedOutputStream and consumer reads from the relative connected PipedInputStream. Both are bufferized in this way: pos = new PipedOutputStream(this.sc.pEnd); bufferedPipe = new BufferedWriter(new OutputStreamWriter(pos)); The problem is that Consumer is really slow to read if compared to the Producer writing speed (because it makes a lot of operations when producer only write). So data at the begin of the pipe are different from data at the end (consumer gets only part of strings written by producer). It seem consumer can't follow the step of producer. note: i can't decrease producer speed because it takes a flow of da   More>>

I have 2 threads, Producer and Consumer. Producer writes on
a PipedOutputStream and consumer reads from the relative connected PipedInputStream. Both are bufferized in
this way:

			
pos = new PipedOutputStream(this.sc.pEnd);
bufferedPipe = new BufferedWriter(new OutputStreamWriter(pos));


The problem is that Consumer is really slow to read if compared to the Producer writing speed (because it makes a
lot of operations when producer only write). So data at the begin of the pipe are different from data at the end
(consumer gets only part of strings written by producer). It seem consumer can't follow the step of producer.

note: i can't decrease producer speed because it takes a flow of data from the network.    <<Less
About | Sitemap | Contact