org.tranche.network
Class ServerStatusUpdateProcess

java.lang.Object
  extended by java.lang.Thread
      extended by org.tranche.commons.DebuggableThread
          extended by org.tranche.network.StatusUpdateProcess
              extended by org.tranche.network.ServerStatusUpdateProcess
All Implemented Interfaces:
java.lang.Runnable

public class ServerStatusUpdateProcess
extends StatusUpdateProcess

The network status update process used when there is a local server.

The server update process consists of contacting a single server in a range of servers.

This process is the cornerstone of the status propagation scheme that was implemented to reduce the number of connections that were needed to be held by servers and clients.

To protected against malicious attack, only core servers can be trusted to return the status of other servers. Non-core servers must be contacted individually to determine their status.

The status table keeps all the rows within it sorted alphabetically by host name. Starting at the local host (if it's a core server), the core servers are split up into groups of a configurable size.

Each of the groups is called a range. Within this range, the first server that is not the local server and is online will be designated the "connection host", or the one from which the updates for that server should be requested.

Core servers with non-core servers alphabetically after them and before another core server must request the status of each of those servers individually.

It is with this orderly scheme that we can be sure the information will be propagated in an orderly manner.

Author:
James "Augie" Hill - augman85@gmail.com, Bryan Smith - bryanesmith@gmail.com

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class org.tranche.network.StatusUpdateProcess
isRunning
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected ServerStatusUpdateProcess()
          Default constructor
 
Method Summary
protected static void adjustStatusTableRowRanges()
          Updates the status table row ranges based on the status of the network.
static java.util.Collection<StatusTableRowRange> getNonCoreServersToUpdate()
          Gets the non-core servers that the local server will update individually.
static ServerStatusTablePerspective getServerStatusTablePerspectiveForServer(java.lang.String host)
          Get the status table information from the perspective of specified host.
static java.util.Collection<StatusTableRowRange> getStatusTableRowRanges()
          Gets the row ranges.
 void run()
          Starts the process.
 
Methods inherited from class org.tranche.network.StatusUpdateProcess
safeStop
 
Methods inherited from class org.tranche.commons.DebuggableThread
debugErr, debugErr, debugOut, isDebug, setDebug
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerStatusUpdateProcess

protected ServerStatusUpdateProcess()

Default constructor

Method Detail

run

public void run()

Starts the process.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getStatusTableRowRanges

public static final java.util.Collection<StatusTableRowRange> getStatusTableRowRanges()

Gets the row ranges.

Returns:
The row ranges

getNonCoreServersToUpdate

public static final java.util.Collection<StatusTableRowRange> getNonCoreServersToUpdate()

Gets the non-core servers that the local server will update individually.

Returns:

adjustStatusTableRowRanges

protected static final void adjustStatusTableRowRanges()

Updates the status table row ranges based on the status of the network.

Also determines the non-core servers the local server should be getting updates from.


getServerStatusTablePerspectiveForServer

public static final ServerStatusTablePerspective getServerStatusTablePerspectiveForServer(java.lang.String host)

Get the status table information from the perspective of specified host. This could be the local host or a remote one.

Parameters:
host - The host for the server from whose perspective we want to see the network
Returns:


This code is free for use both commercially and non-commercially as stated in the project's license