de.knipp.rritoolkit
Interface RegistryChannel

All Known Implementing Classes:
DebugChannelFactory.DebugChannel, TcpChannel

public interface RegistryChannel

interface to a class that implements a communication channel to the registry. Independently from the used transport technology, an implementation must guarantee that the order of responses match the order of the requests. The implementation must be thread-safe, especially it must allow that two different threads may send messages and wait for responses in parallel.

Version:
$Revision: 14936 $
Author:
Klaus Malorny

Method Summary
 void close()
          close the channel.
 boolean isClosed()
          return whether the channel has been closed
 byte[] receive()
          wait for a response from the registry.
 void send(byte[] data, boolean isXml)
          send the given message to the registry.
 

Method Detail

send

void send(byte[] data,
          boolean isXml)
          throws java.io.IOException
send the given message to the registry. As the transport mechanism may need to know whether the data represents the XML or key-value form of the request, it must be specified. If the channel is already closed, an exception is thrown.

Parameters:
data - the data representing the message
isXml - true if the message uses the XML encoding, false if the message uses key-value pairs.
Throws:
java.io.IOException - if the transmission failed

receive

byte[] receive()
               throws java.io.IOException
wait for a response from the registry.

Returns:
the message that has been received
Throws:
java.io.IOException - if the connection has been closed either before or during the call.

isClosed

boolean isClosed()
return whether the channel has been closed

Returns:
true if closed

close

void close()
close the channel. Closing an already closed channel should be ignored



Copyright © 2005-2011 Knipp Medien und Kommunikation GmbH