Description
There is an invariant that "dead" DataOutputStream doesn't mean really dead, because a suspension can still care whether it is zeroLength or not, has implications for resource management. E.g., suppose we wanted to pool DOS objects for reuse. The state we call "dead" for them is not equivalent to "reusable" so should be put back into the pool. This suggests the state dead and method isDead should be renamed to outputComplete or some other name that suggests notDeadYet, but that one aspect of usage is over with, but there can still be suspensions. I think the suspension has to be attached to the DOS while it is live. Hence, we could add a hasAssociatedSuspension bit or reference counter to the DOS object. Then things that are outputComplete but not hasAssociatedSuspension are truly "dead" and could be recycled. Otherwise they would be in state hasAssociatedSuspension until that suspension is resolved.