jpl.mipl.mdms.web.domain
Class ServerRatioOrderer

java.lang.Object
  extended by jpl.mipl.mdms.web.domain.ServerRatioOrderer
All Implemented Interfaces:
ServerOrderer

public class ServerRatioOrderer
extends Object
implements ServerOrderer

Purpose: Instance of ServerOrderer that gives higher priority to servers with the lowest percentage load. If two servers have the same load, then preference is given to the server with a greater connection limit.

   Copyright 2006, California Institute of Technology.
   ALL RIGHTS RESERVED.
   U.S. Government Sponsorship acknowledge. 2006.
   
 ============================================================================
 Modification History :
 ----------------------

 Date              Who              What
 ----------------------------------------------------------------------------
 08/10/2006        Nick             Initial Release
 ============================================================================
 

Version:
$Id: ServerRatioOrderer.java,v 1.1 2006/09/29 18:51:18 ntt Exp $
Author:
Nicholas Toole (Nicholas.T.Toole@jpl.nasa.gov)

Constructor Summary
ServerRatioOrderer(DomainModel model)
           
 
Method Summary
 Comparator getComparator()
          Returns refernce to the comparator used by the instance
 List getServerList(String serverGroup)
          Returns a sorted list of servers for a given server group.
 List getServerList(String serverGroup, List currentOrder)
          Ignores currentOrder parameter and returns the results of calling getServerList(serverGroup)
 Map getServerLists(String[] serverGroups)
          Returns a map of server groups found in pararmeter array to the sorted list of servers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerRatioOrderer

public ServerRatioOrderer(DomainModel model)
Method Detail

getComparator

public Comparator getComparator()
Description copied from interface: ServerOrderer
Returns refernce to the comparator used by the instance

Specified by:
getComparator in interface ServerOrderer
Returns:
Comparator

getServerList

public List getServerList(String serverGroup)
Description copied from interface: ServerOrderer
Returns a sorted list of servers for a given server group.

Specified by:
getServerList in interface ServerOrderer
Parameters:
serverGroup - Server group name
Returns:
Sorted list of servers of that group

getServerList

public List getServerList(String serverGroup,
                          List currentOrder)
Ignores currentOrder parameter and returns the results of calling getServerList(serverGroup)

Specified by:
getServerList in interface ServerOrderer
Parameters:
serverGroup - Server group name
currentOrder - A list of the current server order, can be null or empty.
Returns:
Sorted list of servers of that group

getServerLists

public Map getServerLists(String[] serverGroups)
Returns a map of server groups found in pararmeter array to the sorted list of servers.

Specified by:
getServerLists in interface ServerOrderer
Parameters:
serverGroups - Array of servergroups which will be keys of the resulting map.
Returns:
Map server list map.