com.netflix.loadbalancer
Class PingUrl
java.lang.Object
com.netflix.loadbalancer.PingUrl
- All Implemented Interfaces:
- com.netflix.loadbalancer.IPing
public class PingUrl
- extends java.lang.Object
- implements com.netflix.loadbalancer.IPing
Ping implementation if you want to do a "health check" kind of Ping. This
will be a "real" ping. As in a real http/s call is made to this url e.g.
http://ec2-75-101-231-85.compute-1.amazonaws.com:7101/cs/hostRunning
Some services/clients choose PingDiscovery - which is quick but is not a real
ping. i.e It just asks discovery (eureka) in-memory cache if the server is present
in its Roster PingUrl on the other hand, makes an actual call. This is more
expensive - but its the "standard" way most VIPs and other services perform
HealthChecks.
Choose your Ping based on your needs.
Constructor Summary |
PingUrl()
|
PingUrl(boolean isSecure,
java.lang.String pingAppendString)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PingUrl
public PingUrl()
PingUrl
public PingUrl(boolean isSecure,
java.lang.String pingAppendString)
setPingAppendString
public void setPingAppendString(java.lang.String pingAppendString)
getPingAppendString
public java.lang.String getPingAppendString()
isSecure
public boolean isSecure()
setSecure
public void setSecure(boolean isSecure)
- Should the Secure protocol be used to Ping
- Parameters:
isSecure
-
getExpectedContent
public java.lang.String getExpectedContent()
setExpectedContent
public void setExpectedContent(java.lang.String expectedContent)
- Is there a particular content you are hoping to see?
If so -set this here.
for e.g. the WCS server sets the content body to be 'true'
Please be advised that this content should match the actual
content exactly for this to work. Else yo may get false status.
- Parameters:
expectedContent
-
isAlive
public boolean isAlive(com.netflix.loadbalancer.Server server)
- Specified by:
isAlive
in interface com.netflix.loadbalancer.IPing
main
public static void main(java.lang.String[] args)