Top Inners Fields Constructors Methods
io.undertow.server.handlers.proxy.mod_cluster

pack-priv Class Node

extends Object
Class Inheritance
Static Imports
org.xnio.Bits.allAreClear, .Bits.anyAreSet

Authors
Stuart Douglas, Emanuel Muckenhuber

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final int
private final Balancer
private final ByteBufferPool
private final ProxyConnectionPool
private final ConnectionPoolManager
private final ModClusterContainer
private final List<Context>
private static final int
private static final int
private static final int
private final int
private static final AtomicInteger
private final XnioIoThread
private final String
private final NodeLbStatus
private final NodeConfig
private static final int
private volatile int
private static final AtomicIntegerFieldUpdater<Node>
pack-priv static final AtomicInteger
private final List<Node.VHostMapping>

Constructor Summary

AccessConstructor and Description
protected
Node(NodeConfig nodeConfig, Balancer balancerConfig, XnioIoThread ioThread, ByteBufferPool bufferPool, ModClusterContainer container)

Method Summary

Modifier and TypeMethod and Description
protected boolean
checkAvailable(final boolean existingSession)

protected void
checkHealth(long
the threshold after which the node should be removed
threshold
,
NodeHealthChecker
the node health checker
healthChecker
)

Check the health of the node and try to ping it if necessary.

private void
pack-priv void
elected()

This node got elected to serve a request!

public Balancer
public ProxyConnectionPool

Returns:

the connection pool
getConnectionPool
()

Get or create the connection pool for this node.

pack-priv Context

Returns:

the context, null if there is no matching context
getContext
(final String
the context path
path
,
List<String>
the aliases
aliases
)

Get a context.

pack-priv Collection<Context>
public int
pack-priv int
public int
pack-priv XnioIoThread
public String

Returns:

the jvmRoute
getJvmRoute
()

Get the JVM route.

public int

Returns:

the node load
getLoad
()

Get the load information.

public int

Returns:

the load status
getLoadStatus
()

Get the current load status, based on the number of elections and the current load;

public NodeConfig
public NodeStatus
pack-priv List<Node.VHostMapping>
private int
healthCheckFailed()

Mark a node in error.

pack-priv void
healthCheckPing(final long threshold, NodeHealthChecker healthChecker)

protected void
pack-priv boolean
protected boolean
protected void
protected void
pack-priv void
ping(final HttpServerExchange
the http server exchange
exchange
,
final NodePingUtil.PingCallback
the ping callback
callback
)

Async ping from the user

pack-priv Context

Returns:

the created context
registerContext
(final String
the context path
path
,
final List<String> virtualHosts)

Register a context.

pack-priv Context
removeContext(final String path, final List<String> aliases)

pack-priv void
protected void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

protected void
updateLoad(final int i)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

ACTIVE_PINGback to summary
private static final int ACTIVE_PING
balancerConfigback to summary
private final Balancer balancerConfig
bufferPoolback to summary
private final ByteBufferPool bufferPool
connectionPoolback to summary
private final ProxyConnectionPool connectionPool
connectionPoolManagerback to summary
private final ConnectionPoolManager connectionPoolManager
containerback to summary
private final ModClusterContainer container
contextsback to summary
private final List<Context> contexts
ERRORback to summary
private static final int ERROR
ERROR_MASKback to summary
private static final int ERROR_MASK
HOT_STANDBYback to summary
private static final int HOT_STANDBY
idback to summary
private final int id
idGenback to summary
private static final AtomicInteger idGen
ioThreadback to summary
private final XnioIoThread ioThread
jvmRouteback to summary
private final String jvmRoute
lbStatusback to summary
private final NodeLbStatus lbStatus
nodeConfigback to summary
private final NodeConfig nodeConfig
REMOVEDback to summary
private static final int REMOVED
stateback to summary
private volatile int state
stateUpdaterback to summary
private static final AtomicIntegerFieldUpdater<Node> stateUpdater
vHostIdGenback to summary
pack-priv static final AtomicInteger vHostIdGen
vHostsback to summary
private final List<Node.VHostMapping> vHosts

Constructor Detail

Nodeback to summary
protected Node(NodeConfig nodeConfig, Balancer balancerConfig, XnioIoThread ioThread, ByteBufferPool bufferPool, ModClusterContainer container)

Method Detail

checkAvailableback to summary
protected boolean checkAvailable(final boolean existingSession)
checkHealthback to summary
protected void checkHealth(long threshold, NodeHealthChecker healthChecker)

Check the health of the node and try to ping it if necessary.

Parameters
threshold:long

the threshold after which the node should be removed

healthChecker:NodeHealthChecker

the node health checker

clearActivePingback to summary
private void clearActivePing()
electedback to summary
pack-priv void elected()

This node got elected to serve a request!

getBalancerback to summary
public Balancer getBalancer()
getConnectionPoolback to summary
public ProxyConnectionPool getConnectionPool()

Get or create the connection pool for this node.

Returns:ProxyConnectionPool

the connection pool

getContextback to summary
pack-priv Context getContext(final String path, List<String> aliases)

Get a context.

Parameters
path:String

the context path

aliases:List<String>

the aliases

Returns:Context

the context, null if there is no matching context

getContextsback to summary
pack-priv Collection<Context> getContexts()
getElectedback to summary
public int getElected()
getElectedDiffback to summary
pack-priv int getElectedDiff()
getIdback to summary
public int getId()
getIoThreadback to summary
pack-priv XnioIoThread getIoThread()
getJvmRouteback to summary
public String getJvmRoute()

Get the JVM route.

Returns:String

the jvmRoute

getLoadback to summary
public int getLoad()

Get the load information. Add the error information for clients.

Returns:int

the node load

getLoadStatusback to summary
public int getLoadStatus()

Get the current load status, based on the number of elections and the current load;

Returns:int

the load status

getNodeConfigback to summary
public NodeConfig getNodeConfig()
getStatusback to summary
public NodeStatus getStatus()
getVHostsback to summary
pack-priv List<Node.VHostMapping> getVHosts()
healthCheckFailedback to summary
private int healthCheckFailed()

Mark a node in error. Mod_cluster has a threshold after which broken nodes get removed.

healthCheckPingback to summary
pack-priv void healthCheckPing(final long threshold, NodeHealthChecker healthChecker)
hotStandbyback to summary
protected void hotStandby()
isHotStandbyback to summary
pack-priv boolean isHotStandby()
isInErrorStateback to summary
protected boolean isInErrorState()
markInErrorback to summary
protected void markInError()
markRemovedback to summary
protected void markRemoved()
pingback to summary
pack-priv void ping(final HttpServerExchange exchange, final NodePingUtil.PingCallback callback)

Async ping from the user

Parameters
exchange:HttpServerExchange

the http server exchange

callback:NodePingUtil.PingCallback

the ping callback

registerContextback to summary
pack-priv Context registerContext(final String path, final List<String> virtualHosts)

Register a context.

Parameters
path:String

the context path

Returns:Context

the created context

removeContextback to summary
pack-priv Context removeContext(final String path, final List<String> aliases)
resetLbStatusback to summary
pack-priv void resetLbStatus()
resetStateback to summary
protected void resetState()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
updateLoadback to summary
protected void updateLoad(final int i)
io.undertow.server.handlers.proxy.mod_cluster back to summary

private Class Node.NodeConnectionPoolManager

extends Object
implements ConnectionPoolManager
Class Inheritance
  • java.lang.Object
  • io.undertow.server.handlers.proxy.mod_cluster.Node.NodeConnectionPoolManager
All Implemented Interfaces
io.undertow.server.handlers.proxy.ConnectionPoolManager, io.undertow.server.handlers.proxy.ConnectionPoolErrorHandler, io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
public int
getMaxCachedConnections()

Implements io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getMaxCachedConnections.

Get the maximum number of cached (idle) connections per thread.

public int
getMaxConnections()

Implements io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getMaxConnections.

Get the maximum number of connections per thread.

public int
getMaxQueueSize()

Implements io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getMaxQueueSize.

Get the maximum number of requests which can be queued if there are no connections available.

public int
public int
getSMaxConnections()

Implements io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getSMaxConnections.

Get number of cached connections above which are closed after the time to live.

public long
getTtl()

Implements io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getTtl.

Get the time to live for idle connections.

public boolean
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

NodeConnectionPoolManagerback to summary
private NodeConnectionPoolManager()

Method Detail

clearErrorback to summary
public boolean clearError()

Implements io.undertow.server.handlers.proxy.ConnectionPoolErrorHandler.clearError.

Doc from io.undertow.server.handlers.proxy.ConnectionPoolErrorHandler.clearError.

Clear the connection errors.

Returns:boolean

true if the pool is available again, false otherwise

Annotations
@Override
getMaxCachedConnectionsback to summary
public int getMaxCachedConnections()

Implements io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getMaxCachedConnections.

Doc from io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getMaxCachedConnections.

Get the maximum number of cached (idle) connections per thread.

Annotations
@Override
getMaxConnectionsback to summary
public int getMaxConnections()

Implements io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getMaxConnections.

Doc from io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getMaxConnections.

Get the maximum number of connections per thread.

Annotations
@Override
getMaxQueueSizeback to summary
public int getMaxQueueSize()

Implements io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getMaxQueueSize.

Doc from io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getMaxQueueSize.

Get the maximum number of requests which can be queued if there are no connections available.

Annotations
@Override
getProblemServerRetryback to summary
public int getProblemServerRetry()

Implements io.undertow.server.handlers.proxy.ConnectionPoolManager.getProblemServerRetry.

Returns:int

Doc from io.undertow.server.handlers.proxy.ConnectionPoolManager.getProblemServerRetry.

The amount of time that we should wait before re-testing a problem server

Annotations
@Override
getSMaxConnectionsback to summary
public int getSMaxConnections()

Implements io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getSMaxConnections.

Doc from io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getSMaxConnections.

Get number of cached connections above which are closed after the time to live.

Annotations
@Override
getTtlback to summary
public long getTtl()

Implements io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getTtl.

Doc from io.undertow.server.handlers.proxy.ProxyConnectionPoolConfig.getTtl.

Get the time to live for idle connections.

Annotations
@Override
handleErrorback to summary
public boolean handleError()

Implements io.undertow.server.handlers.proxy.ConnectionPoolErrorHandler.handleError.

Doc from io.undertow.server.handlers.proxy.ConnectionPoolErrorHandler.handleError.

Handle a connection error.

Returns:boolean

true if the pool is still available, false otherwise

Annotations
@Override
isAvailableback to summary
public boolean isAvailable()

Implements io.undertow.server.handlers.proxy.ConnectionPoolErrorHandler.isAvailable.

Doc from io.undertow.server.handlers.proxy.ConnectionPoolErrorHandler.isAvailable.

Check whether pool is available

Returns:boolean

whether the pool is available

Annotations
@Override
io.undertow.server.handlers.proxy.mod_cluster back to summary

pack-priv Class Node.VHostMapping

extends Object
Class Inheritance
  • java.lang.Object
  • io.undertow.server.handlers.proxy.mod_cluster.Node.VHostMapping

Field Summary

Modifier and TypeField and Description
private final List<String>
private final int
private final Node

Constructor Summary

AccessConstructor and Description
pack-priv
VHostMapping(Node node, List<String> aliases)

Method Summary

Modifier and TypeMethod and Description
public List<String>
public int
pack-priv Node
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aliasesback to summary
private final List<String> aliases
idback to summary
private final int id
nodeback to summary
private final Node node

Constructor Detail

VHostMappingback to summary
pack-priv VHostMapping(Node node, List<String> aliases)

Method Detail

getAliasesback to summary
public List<String> getAliases()
getIdback to summary
public int getId()
getNodeback to summary
pack-priv Node getNode()