EDU.oswego.cs.dl.util.concurrent.misc

Class PipedChannel

public class PipedChannel extends SemaphoreControlledChannel

A channel based on a java.io.PipedInputStream and java.io.PipedOutputStream. Elements are serialized using ObjectInputStreams and ObjectOutputStreams upon insertion and extraction from the pipe.

IO Exceptions are transformed into Errors. This is in general not a good idea, but seems to be the most reasonable compromise for the intended usage contexts.

Status Uncertain. There are enough conceptual and implementation snags surrounding use of pipes as Channels to downplay use. However, without such bridges, people would have to duplicate code that should work the same way in both cases.

[ Introduction to this package. ]

Field Summary
protected PipedInputStreaminp_
protected ObjectInputStreamin_
protected PipedOutputStreamoutp_
protected ObjectOutputStreamout_
Constructor Summary
PipedChannel()
Method Summary
protected Objectextract()
Shared mechanics for take-based methods *
protected ObjectInputStreamin()
Return input stream, first constructing if necessary.
protected voidinsert(Object x)
Shared mechanics for put-based methods *
protected ObjectOutputStreamout()
Return output stream, first constructing if necessary.
Objectpeek()
Stubbed out for now *

Field Detail

inp_

protected final PipedInputStream inp_

in_

protected ObjectInputStream in_

outp_

protected final PipedOutputStream outp_

out_

protected ObjectOutputStream out_

Constructor Detail

PipedChannel

public PipedChannel()

Method Detail

extract

protected Object extract()
Shared mechanics for take-based methods *

in

protected ObjectInputStream in()
Return input stream, first constructing if necessary. Needed because Object streams can block on open.

insert

protected void insert(Object x)
Shared mechanics for put-based methods *

out

protected ObjectOutputStream out()
Return output stream, first constructing if necessary. Needed because Object streams can block on open.

peek

public Object peek()
Stubbed out for now *