public class ClientSocketFactory extends java.lang.Object implements ClientSocketFactoryApi
Constructor and Description |
---|
ClientSocketFactory(java.lang.String address,
int port) |
ClientSocketFactory(java.lang.String address,
int port,
boolean isSecure) |
ClientSocketFactory(java.lang.String sourceId,
java.lang.String targetId,
java.lang.String statCategory,
java.lang.String statId,
java.lang.String address,
int port,
boolean isSecure) |
Modifier and Type | Method and Description |
---|---|
void |
allocateLoadBalance()
Allocate a connection for load balancing.
|
void |
busy(long time)
Called when the server responds with "busy", e.g.
|
boolean |
canConnect()
Returns true if can connect to the client.
|
boolean |
canOpen()
Returns true if the server can open a connection.
|
boolean |
canOpenWarm()
Returns true if the server can open a connection.
|
boolean |
canOpenWarmOrRecycle()
Returns true if the server can open a connection.
|
void |
clearRecycle()
Clears the recycled connections, e.g.
|
void |
close()
Close the client
|
void |
disable()
Disable the client
|
void |
enable()
Enable the client
|
void |
enableSessionOnly()
Session only
|
void |
failConnect(long time)
Called when the socket read/write fails.
|
void |
failSocket(long time)
Called when the socket read/write fails.
|
void |
freeLoadBalance()
Free a connection for load balancing.
|
int |
getActiveCount()
Returns the number of active connections.
|
java.lang.String |
getAddress()
Returns the hostname of the target server.
|
long |
getBusyCountTotal()
Returns the count of busy connections.
|
long |
getConnectCountTotal()
Returns the total number of successful socket connections
|
CountMeter |
getConnectionFailProbe() |
ActiveMeter |
getConnectionProbe() |
double |
getCpuLoadAvg()
Gets the CPU load avg
|
java.lang.String |
getDebugId()
Returns the debug id.
|
long |
getFailCountTotal()
Returns the total number of failed connect attempts.
|
java.lang.String |
getId()
Returns the user-readable id of the target server.
|
int |
getIdleCount()
Returns the number of idle connections.
|
ActiveMeter |
getIdleProbe() |
long |
getKeepaliveCountTotal()
Returns the number of times a keepalive connection has been used.
|
java.util.Date |
getLastBusyTime()
Returns the time of the last busy.
|
java.util.Date |
getLastFailConnectTime()
Returns the time of the last failure.
|
java.util.Date |
getLastFailTime()
Returns the time of the last failure.
|
long |
getLastSuccessTime()
Returns the time of the last failure.
|
double |
getLatencyFactor()
Returns the latency factory
|
int |
getLoadBalanceAllocateCount()
Returns the number of load balance allocations
|
long |
getLoadBalanceBusyRecoverTime() |
long |
getLoadBalanceConnectionMin()
The minimum connections for green load balancing.
|
long |
getLoadBalanceConnectTimeout()
The socket timeout when connecting to the target server.
|
long |
getLoadBalanceIdleTime()
How long the connection can be cached in the free pool.
|
long |
getLoadBalanceRecoverTime() |
long |
getLoadBalanceSocketTimeout()
The socket timeout when reading from the target server.
|
long |
getLoadBalanceWarmupTime() |
int |
getLoadBalanceWeight()
The load balance weight.
|
int |
getPort()
Gets the port of the target server.
|
CountMeter |
getRequestBusyProbe() |
CountMeter |
getRequestFailProbe() |
ActiveTimeMeter |
getRequestTimeProbe() |
int |
getStartSequenceId()
Returns the server start/stop sequence.
|
java.lang.String |
getState()
Returns the lifecycle state.
|
void |
init()
Initialize
|
boolean |
isActive()
Returns true if the server is active.
|
boolean |
isBusy(long now) |
boolean |
isDead()
Returns true if the server is dead.
|
boolean |
isEnabled()
Return true if active.
|
boolean |
isFailed(long now) |
boolean |
isHeartbeatActive()
Returns true if the target server's heartbeat is active.
|
void |
notifyHeartbeatStart()
Notify that a heartbeat start has occurred.
|
void |
notifyHeartbeatStop()
Notify that a heartbeat stop has occurred.
|
ClientSocket |
open()
Open a stream to the target server for the load balancer.
|
ClientSocket |
openIfHeartbeatActive()
Open a stream if the target server's heartbeat is active.
|
ClientSocket |
openIfLive()
Open a stream to the target server object persistence.
|
ClientSocket |
openSticky()
Open a stream to the target server for a session.
|
ClientSocket |
openWarm()
Open a stream to the target server, restricted by warmup.
|
void |
setCpuLoadAvg(double load)
Sets the CPU load avg (from backend).
|
void |
setHeartbeatServer(boolean isHeartbeatServer)
Foreign server is in the pod's heartbeat range.
|
void |
setLoadBalanceBusyRecoverTime(long timeout)
Returns how long the connection will be treated as dead.
|
void |
setLoadBalanceConnectionMin(int connectionMin)
The minimum connections for green load balancing.
|
void |
setLoadBalanceConnectTimeout(long timeout)
The socket timeout when connecting to the target server.
|
void |
setLoadBalanceIdleTime(long timeout)
How long the connection can be cached in the free pool.
|
void |
setLoadBalanceRecoverTime(long timeout)
Returns how long the connection will be treated as dead.
|
void |
setLoadBalanceSocketTimeout(long timeout)
The socket timeout when reading from the target server.
|
void |
setLoadBalanceWarmupTime(long timeout)
Returns the time in milliseconds for the slow start throttling.
|
void |
setLoadBalanceWeight(int weight)
The load balance weight.
|
void |
start()
Enable the client.
|
void |
stop()
Disable the client.
|
void |
success()
Called when the server has a successful response
|
void |
toBusy() |
void |
toFail() |
java.lang.String |
toString() |
void |
wake()
We now know that the server is live, e.g.
|
public ClientSocketFactory(java.lang.String address, int port)
public ClientSocketFactory(java.lang.String address, int port, boolean isSecure)
public ClientSocketFactory(java.lang.String sourceId, java.lang.String targetId, java.lang.String statCategory, java.lang.String statId, java.lang.String address, int port, boolean isSecure)
public java.lang.String getId()
getId
in interface ClientSocketFactoryApi
public java.lang.String getDebugId()
getDebugId
in interface ClientSocketFactoryApi
public java.lang.String getAddress()
getAddress
in interface ClientSocketFactoryApi
public int getPort()
getPort
in interface ClientSocketFactoryApi
public void setHeartbeatServer(boolean isHeartbeatServer)
public long getLoadBalanceConnectTimeout()
public void setLoadBalanceConnectTimeout(long timeout)
public long getLoadBalanceConnectionMin()
public void setLoadBalanceConnectionMin(int connectionMin)
public long getLoadBalanceSocketTimeout()
public void setLoadBalanceSocketTimeout(long timeout)
public long getLoadBalanceIdleTime()
public void setLoadBalanceIdleTime(long timeout)
public void setLoadBalanceRecoverTime(long timeout)
public long getLoadBalanceRecoverTime()
public void setLoadBalanceBusyRecoverTime(long timeout)
public long getLoadBalanceBusyRecoverTime()
public void setLoadBalanceWarmupTime(long timeout)
public long getLoadBalanceWarmupTime()
public int getLoadBalanceWeight()
public void setLoadBalanceWeight(int weight)
public int getStartSequenceId()
public void init()
public int getActiveCount()
public int getIdleCount()
public int getLoadBalanceAllocateCount()
public void allocateLoadBalance()
public void freeLoadBalance()
public long getConnectCountTotal()
public long getKeepaliveCountTotal()
public long getFailCountTotal()
public java.util.Date getLastFailTime()
public java.util.Date getLastFailConnectTime()
public long getLastSuccessTime()
public double getLatencyFactor()
public long getBusyCountTotal()
public java.util.Date getLastBusyTime()
public void setCpuLoadAvg(double load)
public double getCpuLoadAvg()
public final boolean isActive()
isActive
in interface ClientSocketFactoryApi
public final boolean isHeartbeatActive()
public boolean isDead()
isDead
in interface ClientSocketFactoryApi
public boolean isFailed(long now)
public boolean isBusy(long now)
public void enable()
enable
in interface ClientSocketFactoryApi
public void disable()
disable
in interface ClientSocketFactoryApi
public java.lang.String getState()
getState
in interface ClientSocketFactoryApi
public boolean canOpen()
public boolean canOpenWarmOrRecycle()
canOpenWarmOrRecycle
in interface ClientSocketFactoryApi
public boolean canOpenWarm()
canOpenWarm
in interface ClientSocketFactoryApi
public boolean isEnabled()
isEnabled
in interface ClientSocketFactoryApi
public void toBusy()
toBusy
in interface ClientSocketFactoryApi
public void toFail()
toFail
in interface ClientSocketFactoryApi
public void failSocket(long time)
failSocket
in interface ClientSocketFactoryApi
public void failConnect(long time)
failConnect
in interface ClientSocketFactoryApi
public void busy(long time)
busy
in interface ClientSocketFactoryApi
public void success()
success
in interface ClientSocketFactoryApi
public void start()
start
in interface ClientSocketFactoryApi
public void stop()
stop
in interface ClientSocketFactoryApi
public void enableSessionOnly()
enableSessionOnly
in interface ClientSocketFactoryApi
public ClientSocket openWarm()
openWarm
in interface ClientSocketFactoryApi
public ClientSocket openIfLive()
openIfLive
in interface ClientSocketFactoryApi
public ClientSocket openIfHeartbeatActive()
public ClientSocket openSticky()
openSticky
in interface ClientSocketFactoryApi
public ClientSocket open()
open
in interface ClientSocketFactoryApi
public void wake()
wake
in interface ClientSocketFactoryApi
public void notifyHeartbeatStart()
notifyHeartbeatStart
in interface ClientSocketFactoryApi
public void notifyHeartbeatStop()
notifyHeartbeatStop
in interface ClientSocketFactoryApi
public void clearRecycle()
clearRecycle
in interface ClientSocketFactoryApi
public void close()
close
in interface ClientSocketFactoryApi
public boolean canConnect()
public ActiveMeter getConnectionProbe()
public CountMeter getConnectionFailProbe()
public ActiveTimeMeter getRequestTimeProbe()
public CountMeter getRequestFailProbe()
public CountMeter getRequestBusyProbe()
public ActiveMeter getIdleProbe()
public java.lang.String toString()
toString
in class java.lang.Object