|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.jca.AbstractResourceAdapter
com.caucho.server.admin.PingThread
public class PingThread
A thread to restart the Resin server if it fails for some reason.
This pinging only catches some problems because it's running in the same JDK process as Resin itself. If the entire JDK freezes, this thread will freeze as well. Assuming the JDK doesn't freeze, the PingThread will catch errors like deadlocks.
| Constructor Summary | |
|---|---|
PingThread()
|
|
| Method Summary | |
|---|---|
void |
addURL(java.lang.String url)
Adds a new URL to be tested. |
protected boolean |
checkPing(Path url,
int count)
Called to check if the connection is alive. |
java.lang.String |
getPingHost()
Returns the server's ping host |
int |
getPingPort()
Returns the server's ping port |
long |
getRetryTime()
Gets the retry time between failing pings |
long |
getSleepTime()
Gets the sleep time between pings |
long |
getSocketTimeout()
Gets the time to wait on a non-responsive socket before giving up. |
int |
getTryCount()
Gets the number of times to retry before giving up |
void |
handleAlarm(Alarm alarm)
Periodically pings the server to check for anything going wrong. |
void |
init()
Initialize the pinger. |
protected void |
pingFailed(Path url)
Called if the ping completely fails. |
protected void |
pingFailedOnce(Path url,
int count,
ReadStream is)
Called if the ping fails once. |
void |
run()
The ping thread checks to make sure the alarm has been successful. |
void |
setInitialSleepTime(Period sleepTime)
Sets the sleep time on startup |
void |
setPingHost(java.lang.String pingHost)
Sets the server's ping host |
void |
setPingPort(int pingPort)
Sets the server's ping port |
void |
setRetryTime(Period retryTime)
Sets the retry time between failing pings |
void |
setSleepTime(Period sleepTime)
Sets the sleep time between pings |
void |
setSocketTimeout(Period timeout)
Sets the number of times to retry before giving up |
void |
setTryCount(int tryCount)
Sets the number of times to retry before giving up |
void |
start(BootstrapContext cxt)
Start the pinger. |
void |
stop()
Stop the pinger. |
java.lang.String |
toString()
|
| Methods inherited from class com.caucho.jca.AbstractResourceAdapter |
|---|
endpointActivation, endpointDeactivation, getXAResources |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PingThread()
| Method Detail |
|---|
public java.lang.String getPingHost()
public void setPingHost(java.lang.String pingHost)
public int getPingPort()
public void setPingPort(int pingPort)
public void addURL(java.lang.String url)
public long getSleepTime()
public void setSleepTime(Period sleepTime)
public void setInitialSleepTime(Period sleepTime)
public long getRetryTime()
public void setRetryTime(Period retryTime)
public int getTryCount()
public void setTryCount(int tryCount)
public long getSocketTimeout()
public void setSocketTimeout(Period timeout)
public void init()
public void start(BootstrapContext cxt)
start in interface ResourceAdapterstart in class AbstractResourceAdapterpublic void handleAlarm(Alarm alarm)
handleAlarm in interface AlarmListenerpublic void run()
run in interface java.lang.Runnable
protected boolean checkPing(Path url,
int count)
throws java.lang.Exception
url - the url to testcount - the number of times the url has been checked without success.
java.lang.Exception
protected void pingFailedOnce(Path url,
int count,
ReadStream is)
throws java.lang.Exception
java.lang.Exception
protected void pingFailed(Path url)
throws java.lang.Exception
java.lang.Exceptionpublic void stop()
stop in interface ResourceAdapterstop in class AbstractResourceAdapterpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||