winstone.cluster
Class SimpleCluster

java.lang.Object
  extended by winstone.cluster.SimpleCluster
All Implemented Interfaces:
java.lang.Runnable, Cluster

public class SimpleCluster
extends java.lang.Object
implements java.lang.Runnable, Cluster

Represents a cluster of winstone containers.

Version:
$Id: SimpleCluster.java,v 1.8 2006/08/10 06:38:31 rickknowles Exp $
Author:
Rick Knowles

Field Summary
static WinstoneResourceBundle CLUSTER_RESOURCES
           
 
Constructor Summary
SimpleCluster(java.util.Map args, java.lang.Integer controlPort)
          Builds a cluster instance
 
Method Summary
 WinstoneSession askClusterForSession(java.lang.String sessionId, WebAppConfiguration webAppConfig)
          Check if the other nodes in this cluster have a session for this sessionId.
 void clusterRequest(byte requestType, java.io.InputStream in, java.io.OutputStream out, java.net.Socket socket, HostGroup hostGroup)
          Accept a control socket request related to the cluster functions and process the request.
 void destroy()
          Destroy the maintenance thread if there is one.
 void handleClusterSessionRequest(java.net.Socket socket, java.io.InputStream in, java.io.OutputStream out, HostGroup hostGroup)
          Handles incoming socket requests for session search
 void handleNodeHeartBeatRequest(java.net.Socket socket, java.io.InputStream in)
          Handles heartbeats.
 void handleNodeListDownloadRequest(java.net.Socket socket, java.io.InputStream in, java.io.OutputStream out)
          Handles incoming socket requests for cluster node lists.
 void run()
          Send a heartbeat every now and then, and remove any nodes that haven't responded in 3 heartbeats.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLUSTER_RESOURCES

public static final WinstoneResourceBundle CLUSTER_RESOURCES
Constructor Detail

SimpleCluster

public SimpleCluster(java.util.Map args,
                     java.lang.Integer controlPort)
Builds a cluster instance

Method Detail

destroy

public void destroy()
Description copied from interface: Cluster
Destroy the maintenance thread if there is one. Prepare for shutdown

Specified by:
destroy in interface Cluster

run

public void run()
Send a heartbeat every now and then, and remove any nodes that haven't responded in 3 heartbeats.

Specified by:
run in interface java.lang.Runnable

askClusterForSession

public WinstoneSession askClusterForSession(java.lang.String sessionId,
                                            WebAppConfiguration webAppConfig)
Check if the other nodes in this cluster have a session for this sessionId.

Specified by:
askClusterForSession in interface Cluster
Parameters:
sessionId - The id of the session to check for
webAppConfig - The web app that owns the session we want
Returns:
A valid session instance

clusterRequest

public void clusterRequest(byte requestType,
                           java.io.InputStream in,
                           java.io.OutputStream out,
                           java.net.Socket socket,
                           HostGroup hostGroup)
                    throws java.io.IOException
Accept a control socket request related to the cluster functions and process the request.

Specified by:
clusterRequest in interface Cluster
Parameters:
requestType - A byte indicating the request type
in - Socket input stream
outSocket - output stream
webAppConfig - Instance of the web app
Throws:
java.io.IOException

handleClusterSessionRequest

public void handleClusterSessionRequest(java.net.Socket socket,
                                        java.io.InputStream in,
                                        java.io.OutputStream out,
                                        HostGroup hostGroup)
                                 throws java.io.IOException
Handles incoming socket requests for session search

Throws:
java.io.IOException

handleNodeListDownloadRequest

public void handleNodeListDownloadRequest(java.net.Socket socket,
                                          java.io.InputStream in,
                                          java.io.OutputStream out)
                                   throws java.io.IOException
Handles incoming socket requests for cluster node lists.

Throws:
java.io.IOException

handleNodeHeartBeatRequest

public void handleNodeHeartBeatRequest(java.net.Socket socket,
                                       java.io.InputStream in)
                                throws java.io.IOException
Handles heartbeats. Just updates the date of this node's last heartbeat

Throws:
java.io.IOException


Copyright © 2013. All Rights Reserved.