public boolean pingService(long timeoutMillis) {
try {
// create our own factory so we can customize the timeout
ClientRemotePojoFactory factory = sender.getClientRemotePojoFactory();
factory.setTimeout(timeoutMillis);
PingAgentService pinger = factory.getRemotePojo(PingAgentService.class);
long agentTime = pinger.ping();
long skew = Math.abs(System.currentTimeMillis() - agentTime);
if (skew > 5 * 60 * 1000L) {
LogFactory.getLog(this.getClass()).debug(
"Agent [" + agent.getName() + "] either took a long time to process a ping (" + skew
+ "ms) or its clock is not synced: " + new Date(agentTime));