org.jboss.web.loadbalancer.scheduler
Class AbstractScheduler

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.web.loadbalancer.scheduler.AbstractScheduler
All Implemented Interfaces:
java.util.EventListener, MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , NotificationListener (src) , Service (src) , ServiceMBean (src)
Direct Known Subclasses:
MinAvgSchedulerService (src) , RoundRobinSchedulerService (src) , WeightedLeastConnectionSchedulerService (src)

public abstract class AbstractScheduler
extends ServiceMBeanSupport (src)
implements NotificationListener (src)

Base-class for Scheduler


Field Summary
protected  org.w3c.dom.Element config
           
protected  java.util.ArrayList hostsDown
           
protected  java.util.ArrayList hostsUp
           
protected  java.lang.String stickyCookieName
           
protected  boolean useStickySession
           
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
AbstractScheduler()
           
 
Method Summary
 Host (src) addHost(java.lang.String hostString)
          Add a host to the up list.
protected  void addHostsFromConfig(org.w3c.dom.Element config)
           
protected  void createService()
          Sub-classes should override this method to provide custum 'create' logic.
protected  void deregisterHostMBean(Host (src)  host)
           
protected  void deregisterHostMBeans()
           
protected  Host (src) findStickyHost(Request (src)  schedRequest)
          Find the sticky host for the given request
protected  ObjectName (src) genObjectNameForHost(Host (src)  host)
           
 void getHost(Request (src)  schedRequest)
           
 java.util.ArrayList getHostsDown()
          Get the list of all hosts that have been marked down.
 java.util.ArrayList getHostsUp()
          Get the list of all hosts that have been marked up.
protected abstract  Host (src) getNextHost()
          Override this method to create a new scheduler.
 void handleNotification(Notification (src)  notification, java.lang.Object handback)
          Callback method from the broadcaster MBean this listener implementation is registered to.
protected  void markNodeDown(Host (src)  host)
           
protected  void markNodeUp(Host (src)  host)
           
protected  void registerHostMBean(Host (src)  host)
           
 void removeHost(java.net.URL url)
          Remove a host from the up list.
 void setConfig(org.w3c.dom.Element config)
           
protected  void setStickyCookie(Request (src)  schedRequest)
          Set the sticky session cookie.
protected  void stopService()
          Sub-classes should override this method to provide custum 'stop' logic.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, startService, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hostsUp

protected java.util.ArrayList hostsUp

hostsDown

protected java.util.ArrayList hostsDown

stickyCookieName

protected java.lang.String stickyCookieName

useStickySession

protected boolean useStickySession

config

protected org.w3c.dom.Element config
Constructor Detail

AbstractScheduler

public AbstractScheduler()
Method Detail

getNextHost

protected abstract Host (src)  getNextHost()
Override this method to create a new scheduler.

Returns:

stopService

protected void stopService()
                    throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'stop' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
stopService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

setConfig

public void setConfig(org.w3c.dom.Element config)
Parameters:
config -

createService

protected void createService()
                      throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'create' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
createService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

addHostsFromConfig

protected void addHostsFromConfig(org.w3c.dom.Element config)
                           throws java.lang.Exception
Throws:
java.lang.Exception

genObjectNameForHost

protected ObjectName (src)  genObjectNameForHost(Host (src)  host)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

registerHostMBean

protected void registerHostMBean(Host (src)  host)

deregisterHostMBean

protected void deregisterHostMBean(Host (src)  host)

deregisterHostMBeans

protected void deregisterHostMBeans()
                             throws java.lang.Exception
Throws:
java.lang.Exception

getHost

public void getHost(Request (src)  schedRequest)
             throws NoHostAvailableException (src) 
Throws:
NoHostAvailableException (src)

setStickyCookie

protected void setStickyCookie(Request (src)  schedRequest)
Set the sticky session cookie.


findStickyHost

protected Host (src)  findStickyHost(Request (src)  schedRequest)
Find the sticky host for the given request

Returns:
null=host not found, otherwise the sticky host URL for this request

markNodeDown

protected void markNodeDown(Host (src)  host)

markNodeUp

protected void markNodeUp(Host (src)  host)

getHostsDown

public java.util.ArrayList getHostsDown()
Get the list of all hosts that have been marked down.


getHostsUp

public java.util.ArrayList getHostsUp()
Get the list of all hosts that have been marked up.


addHost

public Host (src)  addHost(java.lang.String hostString)
             throws java.net.MalformedURLException
Add a host to the up list.

Throws:
java.net.MalformedURLException

removeHost

public void removeHost(java.net.URL url)
Remove a host from the up list.


handleNotification

public void handleNotification(Notification (src)  notification,
                               java.lang.Object handback)
Description copied from interface: NotificationListener (src)
Callback method from the broadcaster MBean this listener implementation is registered to.

Specified by:
handleNotification in interface NotificationListener (src)
Parameters:
notification - the notification object
handback - the handback object given to the broadcaster upon listener registration