com.sun.multicast.allocation
Class MulticastAddressManager

java.lang.Object
  |
  +--com.sun.multicast.allocation.MulticastAddressManager

public class MulticastAddressManager
extends java.lang.Object

A multicast address manager. The MulticastAddressManager class is the primary interface for multicast address management.

There is only one MulticastAddressManager object per Java VM. To get it, use the getMulticastAddressManager static method.


Constructor Summary
protected MulticastAddressManager()
          Create a new MulticastAddressManager.
 
Method Summary
 void addAllocator(MulticastAddressAllocator allocator)
          Add a MulticastAddressAllocator to the list of active allocators.
 Lease allocateAddresses(java.lang.String allocatorName, Scope scope, int ttl, int count, java.util.Date requestedStartTime, java.util.Date requiredStartTime, int requestedDuration, int requiredDuration, AddressSet addressesRequested)
          Allocate one or more multicast addresses, matching the specified parameters.
 MulticastAddressAllocator findAllocator(java.lang.String name)
          Find the allocator with the specified name.
 java.util.Enumeration getAllocators()
          Get the list of active allocators.
static MulticastAddressManager getMulticastAddressManager()
          Get the MulticastAddressManager object for this Java VM.
 ScopeList getScopeList(AddressType addressType)
          Get the multicast scope list.
 void removeAllocator(MulticastAddressAllocator allocator)
          Remove a MulticastAddressAllocator from the list of active allocators.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MulticastAddressManager

protected MulticastAddressManager()
Create a new MulticastAddressManager. This constructor is protected because it should only be used by getMulticastAddressManager() and possible future subclasses of MulticastAddressManager.
Method Detail

getMulticastAddressManager

public static MulticastAddressManager getMulticastAddressManager()
Get the MulticastAddressManager object for this Java VM.
Returns:
the MulticastAddressManager object for this Java VM

getScopeList

public ScopeList getScopeList(AddressType addressType)
                       throws AddressAllocationException
Get the multicast scope list. If an address type is specified, only scopes with that address type will be included. Otherwise, all available scopes will be included.
Parameters:
addressType - the AddressType requested (null if none)
Returns:
the multicast scope list
Throws:
AddressAllocationException - if an exception occurs

allocateAddresses

public Lease allocateAddresses(java.lang.String allocatorName,
                               Scope scope,
                               int ttl,
                               int count,
                               java.util.Date requestedStartTime,
                               java.util.Date requiredStartTime,
                               int requestedDuration,
                               int requiredDuration,
                               AddressSet addressesRequested)
                        throws AddressAllocationException,
                               NoAddressAvailableException
Allocate one or more multicast addresses, matching the specified parameters. Each allocator is asked to meet the request until one does. If no allocator can meet the request, NoAddressAvailableException is thrown. No provision is made for a single request being satisfied by several different allocators.
Parameters:
allocatorName - the name of a specific allocator requested; null if none (recommended)
scope - the administrative scope requested
ttl - the maximum ttl that will be used
count - the number of multicast addresses requested (usually one)
requestedStartTime - the requested start time (null if now)
requiredStartTime - the latest acceptable start time (null if now)
requestedDuration - the requested duration in seconds (-1 if indefinite)
requiredDuration - the required duration in seconds (-1 if indefinite)
addressesRequested - a requested address set (null if any will do)
Returns:
the multicast address lease granted
Throws:
javax.jrms.addralloc.AddressAllocationException - if an error occurred
javax.jrms.addralloc.NoAddressAvailableException - if no address was available that met the requirements

addAllocator

public void addAllocator(MulticastAddressAllocator allocator)
                  throws AddressAllocationException
Add a MulticastAddressAllocator to the list of active allocators. If there is already an allocator with the same name in the list, it is removed first.
Parameters:
allocator - the new allocator
Throws:
javax.jrms.addralloc.AddressAllocationException - if the request could not be satisfied

removeAllocator

public void removeAllocator(MulticastAddressAllocator allocator)
                     throws AddressAllocationException
Remove a MulticastAddressAllocator from the list of active allocators. If the allocator was not on the list, nothing is done.
Parameters:
allocator - the allocator to be removed
Throws:
javax.jrms.addralloc.AddressAllocationException - if the request could not be satisfied

getAllocators

public java.util.Enumeration getAllocators()
                                    throws AddressAllocationException
Get the list of active allocators. The Enumeration returned is a snapshot of the allocator list. It will not be updated if allocators are added or removed.
Returns:
an Enumeration of the list of allocators
Throws:
javax.jrms.addralloc.AddressAllocationException - if the request could not be satisfied

findAllocator

public MulticastAddressAllocator findAllocator(java.lang.String name)
                                        throws AddressAllocationException
Find the allocator with the specified name.
Parameters:
name - name to be found
Returns:
the allocator with the specified name (null if not found)
Throws:
javax.jrms.addralloc.AddressAllocationException - if the request could not be satisfied


JavaTM Reliable MulticastTM Service version 1.1
Copyright (c) 2001, Sun Microsystems Laboratories, All rights reserved.