public class SimpleCluster extends java.lang.Object implements java.lang.Runnable, Cluster
Modifier and Type | Field and Description |
---|---|
static WinstoneResourceBundle |
CLUSTER_RESOURCES |
Constructor and Description |
---|
SimpleCluster(java.util.Map args,
java.lang.Integer controlPort)
Builds a cluster instance
|
Modifier and Type | Method and Description |
---|---|
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.
|
public static final WinstoneResourceBundle CLUSTER_RESOURCES
public SimpleCluster(java.util.Map args, java.lang.Integer controlPort)
public void destroy()
Cluster
public void run()
run
in interface java.lang.Runnable
public WinstoneSession askClusterForSession(java.lang.String sessionId, WebAppConfiguration webAppConfig)
askClusterForSession
in interface Cluster
sessionId
- The id of the session to check forwebAppConfig
- The web app that owns the session we wantpublic void clusterRequest(byte requestType, java.io.InputStream in, java.io.OutputStream out, java.net.Socket socket, HostGroup hostGroup) throws java.io.IOException
clusterRequest
in interface Cluster
requestType
- A byte indicating the request typein
- Socket input streamoutSocket
- output streamwebAppConfig
- Instance of the web appjava.io.IOException
public void handleClusterSessionRequest(java.net.Socket socket, java.io.InputStream in, java.io.OutputStream out, HostGroup hostGroup) throws java.io.IOException
java.io.IOException
public void handleNodeListDownloadRequest(java.net.Socket socket, java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void handleNodeHeartBeatRequest(java.net.Socket socket, java.io.InputStream in) throws java.io.IOException
java.io.IOException
Copyright © 2013. All Rights Reserved.