Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.net
Class AcceptManager

java.lang.Object
  extended by com.jivesoftware.forum.net.AcceptManager
All Implemented Interfaces:
JiveManager

public class AcceptManager
extends java.lang.Object
implements JiveManager

Manages the server sockets that accept incoming connections.

The AcceptManager is responsible for managing AcceptPorts, enforcing any AcceptPolicies that are in place, and passing accepted connections to the ConnectionManager for management.


Constructor Summary
AcceptManager(ConnectionManager connMan, java.lang.String portNamePrefix)
          Create the accept manager with the given connection manager to receive incoming connections.
 
Method Summary
 AcceptPort createAcceptPort(java.net.InetAddress portAddress, int portNumber)
          Creates a new accept port that will be bound to the given port address.
 void deleteAcceptPort(AcceptPort acceptPort)
          Removes the given accept port relying on the underlying port to properly clean up it's own resources, running threads, and delete any relevant configuration properties.
 void destroy()
          Notifies the manager to release any resources that may be holding on too.
 AcceptPort getAcceptPort(java.net.InetAddress portAddress, int portNumber)
          Obtains an accept port by address and port.
 int getAcceptPortCount()
          Returns the number of accept ports being managed.
 java.util.Iterator getAcceptPorts()
          Obtain an iterator over all the AcceptPorts being managed.
 java.util.Iterator getAcceptPorts(BasicResultFilter filter)
          Obtain an iterator over the AcceptPorts being managed that comply with the given result filter.
 AcceptPolicy getGlobalAcceptPolicy()
          Returns the accept policy.
 void initialize()
          Initialize the manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AcceptManager

public AcceptManager(ConnectionManager connMan,
                     java.lang.String portNamePrefix)

Create the accept manager with the given connection manager to receive incoming connections.

Parameters:
connMan - the connection manager the accept manager will use for incoming connections.
portNamePrefix - the prefix for the configuration name root describing ports to manage by this accept manager
Method Detail

initialize

public void initialize()
Description copied from interface: JiveManager
Initialize the manager. It is within this method that it is ok to create, access and/or otherwise use external classes (including caches). Until this method is called implementation should not access any external classes that could possibly either access one of the main Factory classes or any caches since doing so can cause deadlocks and possible clustering issues during startup.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
initialize in interface JiveManager

destroy

public void destroy()
Description copied from interface: JiveManager
Notifies the manager to release any resources that may be holding on too. This could also be used to clear out the managers caches, etc.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
destroy in interface JiveManager

getGlobalAcceptPolicy

public AcceptPolicy getGlobalAcceptPolicy()
Returns the accept policy.

Returns:
the accept policy.

getAcceptPortCount

public int getAcceptPortCount()
Returns the number of accept ports being managed.

Returns:
the number of accept ports managed.

getAcceptPorts

public java.util.Iterator getAcceptPorts()

Obtain an iterator over all the AcceptPorts being managed.

Returns:
an iterator of accept ports managed.

getAcceptPorts

public java.util.Iterator getAcceptPorts(BasicResultFilter filter)

Obtain an iterator over the AcceptPorts being managed that comply with the given result filter.

Parameters:
filter - the filter to apply to the port list results.
Returns:
an iterator of accept ports managed after filtering.

getAcceptPort

public AcceptPort getAcceptPort(java.net.InetAddress portAddress,
                                int portNumber)
                         throws NotFoundException

Obtains an accept port by address and port.

If the portAddress is null, and there is more than one accept port bound to the same port (e.g. multi-homed hosts with different accept ports on each interface), one of the matching ports is returned. There is no guarantee which will be returned, or if the same or different ports will be returned on subsequent calls. If it is important to obtain all accept ports bound to a particular port, on any interface, it is better to search the list of accept ports using the getAcceptPorts() method.

Parameters:
portAddress - the address of the accept port to remove or null for any/all addresses.
portNumber - the number of the port to remove or null for any/all.
Returns:
the accept port corresponding to the given address and port number.
Throws:
NotFoundException - if no matching accept port was found.

createAcceptPort

public AcceptPort createAcceptPort(java.net.InetAddress portAddress,
                                   int portNumber)
                            throws AlreadyExistsException

Creates a new accept port that will be bound to the given port address.

Port creation uses JiveGlobals.setJiveProperty() to set up the port under a root "portx" name where 'x' is some number to differentiate ports from each other. This is a workaround to make the property naming model fit with XML trees where several parallel settings must exist.

Creation of the accept port does not bind the port or open it for accepting new connections. Adjust the resulting AcceptPort instance in order to configure it's initial setup.

Parameters:
portAddress - the address to set the accept port on or null to accept connections on any/all local addresses..
portNumber - the port number of the accept port to create.
Returns:
the created accept port.
Throws:
AlreadyExistsException - if an accept port already exists on the given address and port.

deleteAcceptPort

public void deleteAcceptPort(AcceptPort acceptPort)

Removes the given accept port relying on the underlying port to properly clean up it's own resources, running threads, and delete any relevant configuration properties.

Parameters:
acceptPort - the accept port to remove.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.