Why doesn't more Java code use PipedInputStream / PipedOutputStream?

前端 未结 9 2137
感动是毒
感动是毒 2020-12-02 12:56

I\'ve discovered this idiom recently, and I am wondering if there is something I am missing. I\'ve never seen it used. Nearly all Java code I\'ve worked with in the wild fav

9条回答
  •  星月不相逢
    2020-12-02 13:44

    I tried using these classes a while back for something, I forget the details. But I did discover that their implementation is fatally flawed. I can't remember what it was but I have a sneaky memory that it may have been a race condition which meant that they occasionally deadlocked (And yes, of course I was using them in separately threads: they simply aren't usable in a single thread and weren't designed to be).

    I might have a look at their source code andsee if I can see what the problem might have been.

提交回复
热议问题