csp.lang
Class LinkDriver
java.lang.Object
|
+--csp.lang.LinkDriver
- Direct Known Subclasses:
- ActionListenerDriver, BoundedBuffer, Buffer, ChannelListenerDriver, LowerBoundedBuffer, OverSamplingBuffer, OverwriteBuffer, Port, Rendezvous, SubSamplingBuffer, TCPIP, Timer, UDP, UpperBoundedBuffer
- public abstract class LinkDriver
- extends java.lang.Object
A link driver determines the actual way of communication and its subclass is the only hardware
dependent part of the csp package. It can provide internal (e.g. via memory such as a
rendezvous or buffered mechanism) or external (e.g. by peripherals such as RS232, PCI or
TCP/IP) communication.
The link driver can be plugged into a channel and provides a protocol of data-transfer
via hardware (e.g. memory or peripherals). The channel provides the necessary
synchronization and scheduling.
The combination of channels and link drivers is powerful in that the concept provides a
general framework for communication between two or more threads in the same
address space (i.e. same memory) or for communication between systems (e.g. distributed
systems). As a result, processes will become highly independent of their physical
location on the total system. This enlarges the portability of enormously.
Each link driver class must extend the LinkDriver
class.
The LinkDriver
class is an abstract class which provides an abstract
read()
and write()
method. Furtermore, the LinkDriver
implements a state
variable, three static constants to set the state of the
link driver, and a copy(..)
method for copying source objects into destination
objects.
A link driver extends the LinkDriver class and must implement the read()
and write()
methods. The state
variable must be set
NONEMPTUFULL
, EMPTY
, or FULL
according the state of
the buffer used in the link driver. The initiate method can be
overridden to initiate the state variable. The state variable is set to EMPTY by default.
Link driver states:
EMPTY : buffer reached empty state
FULL : buffer reached full state
NONEMPTYFULL : buffer is not empty and not full
Three basic mechanisms can be created by these constants, i.e. synchronous,
quasi-synchronous, and asynchronous. Examples of these mechanisms are respectively
the rendezvous communication, buffered communication, and a timer.
The type of synchronization is the choice of the programmer, however the
synchronous (i.e. rendezvous) mechanism is preferred according to the CSP concept.
Copyright © 1996-1999 University of Twente. All Rights Reserved.
- Version:
- December 1999, version 0.9, revision 16.
- Author:
- Gerald H. Hilderink, G.H.Hilderink@el.utwente.nl
Method Summary |
abstract void |
read(java.lang.Object object)
Read an object. |
abstract void |
write(java.lang.Object object)
Write specified object. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
LinkDriver
public LinkDriver()
read
public abstract void read(java.lang.Object object)
throws IOException
- Read an object.
- Parameters:
object
- the object to copy the message in when receiving- Throws:
- IOException - if an I/O error occurs
write
public abstract void write(java.lang.Object object)
throws IOException
- Write specified object.
- Parameters:
object
- the object to send- Throws:
- IOException - if an I/O error occurs.