Package org.jcsp.lang
Class BlackHoleChannel
- java.lang.Object
-
- org.jcsp.lang.BlackHoleChannel
-
- All Implemented Interfaces:
ChannelOutput,Poisonable
public class BlackHoleChannel extends Object implements ChannelOutput
This implementsChannelOutputwith black hole semantics.Description
BlackHoleChannel is an implementation ofChannelOutputthat yields black hole semantics for the channel. Writers may always write but there can be no readers. Any number of writers may share the same black hole.Note: BlackHoleChannels are used for masking off unwanted outputs from processes. They are useful when we want to reuse an existing process component intact, but don't need some of its output channels (i.e. we don't want to redesign and reimplement the component to remove the redundant channels). Normal channels cannot be plugged in and left dangling as this may deadlock (parts of) the component being reused.
- Author:
- P.H. Welch
- See Also:
ChannelOutput,One2OneChannel,Any2OneChannel,One2AnyChannel,Any2AnyChannel
-
-
Constructor Summary
Constructors Constructor Description BlackHoleChannel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidpoison(int strength)This injects poison into the channel.voidwrite(Object object)Write an Object to the channel and lose it.
-
-
-
Method Detail
-
write
public void write(Object object)
Write an Object to the channel and lose it.- Specified by:
writein interfaceChannelOutput- Parameters:
object- the object to write to the channel.
-
poison
public void poison(int strength)
Description copied from interface:PoisonableThis injects poison into the channel. If the channel was not explicitly constructed to be poisonable or if the strength of poison is not greater than the channel immunity level, the poison will have no effect.- Specified by:
poisonin interfacePoisonable- Parameters:
strength- the strength of the poison (must be >= 0).
-
-