solar.service.multicast
Class NaiveMulticastService

java.lang.Object
  |
  +--solar.service.BaseService
        |
        +--solar.service.multicast.NaiveMulticastService
All Implemented Interfaces:
EventHandler, MulticastConstants, MulticastService, RequestHandler, Service

public class NaiveMulticastService
extends BaseService
implements MulticastService, MulticastConstants

A naive multicast service does not attempt to build a dissemination tree and simply sends the message directly to every subscriber in best-effort. Notice groupId must be global unique for semantic correctness.

Version:
$Id: NaiveMulticastService.java,v 1.18 2003/10/05 18:50:58 glchen Exp $
Author:
Guanling Chen

Field Summary
protected  DirectoryService _directory
           
protected  java.util.Hashtable _groups
           
protected  Address _laddr
           
protected  org.apache.log4j.Logger _log
          The logger for this multicast service.
protected  java.util.Hashtable _members
           
protected  RpcService _rpc
           
protected  TransportService _transport
           
 
Fields inherited from class solar.service.BaseService
_inited, _manager, _name
 
Fields inherited from interface solar.service.multicast.MulticastConstants
GROUP_ID
 
Constructor Summary
NaiveMulticastService()
           
 
Method Summary
 void create(Id groupId)
          Create a multicast group.
 void destroy(Id groupId)
          Destroy a multicast group.
private  void doJoin(Id groupId, MulticastMember member, boolean local)
           
private  void doLeave(Id groupId, MulticastMember member, boolean local)
           
private  void doMulticast(Id groupId, Event evt, boolean local)
           
private  Name getNameByGroupId(Id groupId)
           
 java.lang.Object handleRequest(Request request)
          Processing a request.
 void initDependents()
          Initialize dependent services here.
 void join(Id groupId, MulticastMember member)
          Join a multicast group.
 void leave(Id groupId, MulticastMember member)
          Leave a multicast group.
 void multicast(Id groupId, Event evt)
          Multicast an application-data unit to all group memebers.
 
Methods inherited from class solar.service.BaseService
assertInited, getDependentService, getName, getServiceManager, handleDispatchUnit, handleEvent, handleEvent, hasInited, init, init, setInited, setName, setServiceManager, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface solar.service.Service
getName, getServiceManager, handleDispatchUnit, hasInited, init, setName, setServiceManager, start, stop
 
Methods inherited from interface solar.api.EventHandler
handleEvent
 

Field Detail

_log

protected org.apache.log4j.Logger _log
The logger for this multicast service.


_directory

protected DirectoryService _directory

_rpc

protected RpcService _rpc

_transport

protected TransportService _transport

_laddr

protected Address _laddr

_groups

protected java.util.Hashtable _groups

_members

protected java.util.Hashtable _members
Constructor Detail

NaiveMulticastService

public NaiveMulticastService()
Method Detail

initDependents

public void initDependents()
                    throws ServiceException
Description copied from interface: Service
Initialize dependent services here.

Specified by:
initDependents in interface Service
Overrides:
initDependents in class BaseService
ServiceException

handleRequest

public java.lang.Object handleRequest(Request request)
                               throws java.lang.Exception
Description copied from interface: RequestHandler
Processing a request.

Specified by:
handleRequest in interface RequestHandler
Overrides:
handleRequest in class BaseService
java.lang.Exception

create

public void create(Id groupId)
            throws MulticastException
Description copied from interface: MulticastService
Create a multicast group.

Specified by:
create in interface MulticastService
MulticastException

destroy

public void destroy(Id groupId)
             throws MulticastException
Description copied from interface: MulticastService
Destroy a multicast group.

Specified by:
destroy in interface MulticastService
MulticastException

join

public void join(Id groupId,
                 MulticastMember member)
          throws MulticastException
Description copied from interface: MulticastService
Join a multicast group.

Specified by:
join in interface MulticastService
MulticastException

leave

public void leave(Id groupId,
                  MulticastMember member)
           throws MulticastException
Description copied from interface: MulticastService
Leave a multicast group.

Specified by:
leave in interface MulticastService
MulticastException

multicast

public void multicast(Id groupId,
                      Event evt)
               throws MulticastException
Description copied from interface: MulticastService
Multicast an application-data unit to all group memebers.

Specified by:
multicast in interface MulticastService
MulticastException

getNameByGroupId

private Name getNameByGroupId(Id groupId)

doJoin

private void doJoin(Id groupId,
                    MulticastMember member,
                    boolean local)
             throws MulticastException
MulticastException

doLeave

private void doLeave(Id groupId,
                     MulticastMember member,
                     boolean local)
              throws MulticastException
MulticastException

doMulticast

private void doMulticast(Id groupId,
                         Event evt,
                         boolean local)
                  throws MulticastException
MulticastException