jGCS Documentation

net.sf.jgcs
Interface DataSession

All Known Implementing Classes:
AbstractDataSession, AbstractPollingDataSession

public interface DataSession

This class defines a DataSession. This Session must be used to send and receive messages to/from the group. An instance of a DataSession must be created on the Protocol interface.

Version:
1.0
Author:
Nuno Carvalho
See Also:
Protocol

Method Summary
 void close()
          Closes the session.
 Message createMessage()
          Creates an empty message that can be used (transmitted) through the session.
 GroupConfiguration getGroup()
          Gets the group associated with this session.
 void multicast(Message msg, Service service, java.lang.Object cookie, Annotation... annotation)
          Sends a message to the group.
 void send(Message msg, Service service, java.lang.Object cookie, java.net.SocketAddress destination, Annotation... annotation)
          Sends a message to one particular member of the group.
 void setExceptionListener(ExceptionListener exception)
          Adds a listener to deliver exceptions related to message reception.
 void setMessageListener(MessageListener listener)
          Adds a listener to deliver messages from this channel.
 void setServiceListener(ServiceListener listener)
          Adds a listener to deliver notifications from this channel.
 

Method Detail

getGroup

GroupConfiguration getGroup()
Gets the group associated with this session.

Returns:
the group associated with this session.

setMessageListener

void setMessageListener(MessageListener listener)
                        throws ClosedSessionException
Adds a listener to deliver messages from this channel.

Parameters:
listener - The listener to be bound to the channel.
Throws:
ClosedSessionException

setServiceListener

void setServiceListener(ServiceListener listener)
                        throws ClosedSessionException
Adds a listener to deliver notifications from this channel.

Parameters:
listener - the listener to be bound to the channel.
Throws:
ClosedSessionException

setExceptionListener

void setExceptionListener(ExceptionListener exception)
                          throws ClosedSessionException
Adds a listener to deliver exceptions related to message reception.

Parameters:
exception - the exception thrown by the implementation of the interface.
Throws:
ClosedSessionException

close

void close()
Closes the session. All resources that the session holds should be freed and therefore no subsequent communication can be done.


createMessage

Message createMessage()
                      throws ClosedSessionException
Creates an empty message that can be used (transmitted) through the session.

Returns:
The message created.
Throws:
ClosedSessionException

multicast

void multicast(Message msg,
               Service service,
               java.lang.Object cookie,
               Annotation... annotation)
               throws java.io.IOException,
                      UnsupportedServiceException

Sends a message to the group.

Parameters:
msg - The message to be sent.
service - the service needed by the application for message delivery (e.g. total order) or null to use the default channel service.
cookie - a cookie used to identify the message in the future (e.g. service notifications).
annotation - semantic information provided by the application to be used by communication protocols (e.g. semantic reliability).
Throws:
java.io.IOException
UnsupportedServiceException

send

void send(Message msg,
          Service service,
          java.lang.Object cookie,
          java.net.SocketAddress destination,
          Annotation... annotation)
          throws java.io.IOException,
                 UnsupportedServiceException

Sends a message to one particular member of the group.

Parameters:
msg - The message to be sent.
service - the service needed by the application for message delivery (e.g. total order) or null to use the default channel service.
cookie - a cookie used to identify the message in the future (e.g. service notifications).
destination - the destination of the message.
annotation - semantic information provided by the application to be used by communication protocols (e.g. semantic reliability).
Throws:
java.io.IOException
UnsupportedServiceException

jGCS Documentation

Copyright (c) 2006, Universidade de Lisboa
For updates and related information please see jGCS home page