Re: Double streams



Oliver Wong wrote:
Well, i tried flushing. It doesn't work.


When you say "It doesn't work", it's not clear to me what the problem is. Exceptions being thrown? Application deadlocks? Characters arrive in random order? etc.

Well, it does not change anything in what's going on. So a deadlock of some sort i would guess. The characters arrive in the order they should to the inner.

Reading and writing are in seperate threads, yeah. Each of the four streams are in their own thread.


This is strange to me. I expected for there to be two threads, not four. One thread is producing data which is pushes into the FooOutputStream, which then forwards the data to the PipedOutputStream (all within the same thread). Then, a second thread, reads from the FooInputStream, which then requests data from the PipedInputStream, and then consumes the data.

Yeah... i tried to replicate my problem on a smaller scale. I'm fiddling with RMI. So two clients, each of whom has the Foo* Streams, and inside these there is a Remote interface, which can call read() and write(), respectively, on an object on the server. This object being a stream, which extends PipedOutputStream (or PipedInputStream), and the two clients communicate with eachother with the server (and the pipes) as a proxy.

So i just made it all local, and put them all in their seperate threads to test it... but i still get the deadlock.

Same thing happens in the RMI scenario, though:

client1 -> client1outputstream.write -> serveroutputstream.write -> serverinputstream.read -> client2inputstream.read -> deadlock (-> client2)

I would be happy to try another solution to exchange this data between the clients, though. It's not a must to do it this way, it's just the way that i just sorta stumbled upon. And since this error arose, and i don't understand, i thought i'd at least attempt to solve it before possibly moving on to another solution.

/Carsten
.



Relevant Pages

  • Re: COM+ Event puzzle
    ... >> But if there were one or more clients were in deadlock, the server might ... Supposed that computer A were in deadlock and there were 3 ... >> outdated THREE refreshing command one by one? ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: COM+ Event puzzle
    ... would publish a method to all the subscribed clients to refresh the dataset. ... But if there were one or more clients were in deadlock, the server might ... Supposed that computer A were in deadlock and there were 3 refreshing ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: COM+ Event puzzle
    ... But if there were one or more clients were in deadlock, the server might ... outdated THREE refreshing command one by one? ...
    (microsoft.public.dotnet.distributed_apps)
  • COM+ Event puzzle
    ... database modification, if someone upated the database, then the COM server ... would publish a method to all the subscribed clients to refresh the dataset. ... But if there were one or more clients were in deadlock, the server might ...
    (microsoft.public.dotnet.distributed_apps)
  • Blocking Player when Server not Saturated
    ... I tried backing off the Load Simulator streams more, ... won't play from the server without stopping to rebuffer! ... >>I'm dividing the load simulation between two clients ...
    (microsoft.public.windowsmedia.server)