final Timer pingTimer = new Timer("PingService", true); //Mark the timer as daemon so that it does not hold up appserver shutdown
TimerTask pingTask = new TimerTask() {
public void run() {
Image img = null;
try {
HashMap<String,String> map = new HashMap<String,String>();
map.put("product", version.getProductName().replace(";", ":"));
map.put("version", getVersionNumber());
map.put("context", CONTEXT);
// Disable module status usage tracking.
//map.put("modules", activeModules.generateModuleStatus());
img = RegistrationUtil.getUpdateCenterImage();
img.setMetaData(map);
img.refreshCatalog(img.getPreferredAuthorityName());
logger.log(Level.INFO, "Domain Pinged: {0}",
img.getPreferredAuthorityName());
if (logger.isLoggable(Level.FINE)) {
logger.fine("X-JPkg-Metadata: product: " +
map.get("product"));
logger.fine("X-JPkg-Metadata: version: " +
map.get("version"));
logger.fine("X-JPkg-Metadata: context: " +
map.get("context"));
//logger.fine("X-JPkg-Metadata: modules: " + map.get("modules"));
}
} catch (Exception e) {
// should the timer schedule be changed in case of
// exception?
if (img != null)
logger.log(Level.FINE, "Domain Ping: Unable to refresh catalog: {0}", img.getPreferredAuthorityName());
else
logger.log(Level.FINE, "Domain Ping: Unable to refresh catalog. Null image.");
logger.fine(e.getMessage());
}
// set the time stamp even in case of failure to ping,