org.objectweb.carol.irmi
Interface Interceptor

All Superinterfaces:
Constants
All Known Subinterfaces:
ClientInterceptor
All Known Implementing Classes:
ClientLogger

public interface Interceptor
extends Constants

The Interceptor API provides callbacks for sending and receiving specialized data along with remote calls made by this RMI implementation. This is a powerful feature that must be carefully used. The send(byte, ObjectOutput) and receive(byte, ObjectInput) implementations must be symmetric between client and server interceptor implementations so as not to corrupt the protocol used by this RMI implementation.

Additionally for performance reasons implementors of this interface should be careful to not send/receive too many bytes from since these callbacks are invoked for each remote method call made by this RMI implementation.

This interface is used on both the server and client communication endpoints although client interceptors must implement the ClientInterceptor specialization in order to be Serializable.

Author:
Rafael H. Schloming <rhs@mit.edu>
See Also:
Server.Server(ClientInterceptor, Interceptor)

Field Summary
 
Fields inherited from interface org.objectweb.carol.irmi.Constants
DGC_PING, METHOD_CALL, METHOD_ERROR, METHOD_RESULT, SYSTEM_ERROR
 
Method Summary
 void receive(byte code, java.io.ObjectInput in)
          This method is invoked when a message is received from the server or client during a remote call.
 void send(byte code, java.io.ObjectOutput out)
          This method is invoked when a message is sent to the server or client during a remote call.
 

Method Detail

receive

void receive(byte code,
             java.io.ObjectInput in)
             throws java.io.IOException,
                    java.lang.ClassNotFoundException
This method is invoked when a message is received from the server or client during a remote call. The type of message is indicated by the code parameter. Legal values may be found in the Constants interface. An ObjectInput instance is provided for reading additional information included by a corresponding send(byte, ObjectOutput) implementation on the sending end of the message.

Parameters:
code - indicates the type of message being received
in - available for reading interceptor specific protocol data
Throws:
java.io.IOException - when there is an underlying communication error with the ObjectInput instance
java.lang.ClassNotFoundException - when there is an error deserializing objects from the ObjectInput instances

send

void send(byte code,
          java.io.ObjectOutput out)
          throws java.io.IOException
This method is invoked when a message is sent to the server or client during a remote call. The type of message is indicated by the code parameter. Legal values may be found in the Constants interface. An ObjectOutput instance is provided for sending additional information to the receive(byte, ObjectInput) implementation on the receiving end of the message.

Parameters:
code - indicates the type of message being sent
out - available for sending output to the receiving interceptor implementation
Throws:
java.io.IOException - when there is an underlyinc communication error with the ObjectOutput instance