1 23 package com.sun.enterprise.admin.server.core; 24 25 26 import java.util.logging.Level ; 27 import java.util.logging.Logger ; 28 29 import com.sun.enterprise.admin.common.constant.AdminConstants; 30 import com.sun.enterprise.instance.ServerManager; 31 import com.sun.enterprise.instance.InstanceEnvironment; 32 33 43 44 public final class ManualChangeTracker 45 { 46 49 static Logger logger = Logger.getLogger(AdminConstants.kLoggerName); 50 51 54 private static int sleepPeriod = 120000; 56 70 71 74 private static TrackerThread trackerThread = null; 75 76 80 static void start() { 81 logger.log(Level.FINE, "core.tracker_thread_starting"); 82 trackerThread = new TrackerThread(); 83 trackerThread.start(); 84 } 85 86 93 static void stop() { 94 trackerThread = null; 95 logger.log(Level.FINE, "core.tracker_thread_stopping"); 96 } 97 98 private static class TrackerThread extends Thread 99 { 100 private static final int SLEEPTIME = sleepPeriod; 101 102 public void run() 103 { 104 Thread t = Thread.currentThread(); 105 106 while (t == trackerThread) { 107 try { 108 sleep(SLEEPTIME); 109 } catch ( InterruptedException ex ) {} 110 111 try { 112 113 String [] instanceIds = ServerManager.instance().getInstanceNames(false); 114 for (int i = 0 ; i < instanceIds.length ; i ++) { 115 try { 116 String instanceId = instanceIds[i]; 117 InstanceEnvironment ie = new InstanceEnvironment(instanceId); 118 ManualChangeStatus mcs = new ManualChangeStatus(); 119 120 121 mcs.setServerXmlFileChanged( 122 ie.hasHotXmlChanged()); 123 mcs.setRealmsKeyFileChanged( 124 ie.hasHotRealmsKeyChanged()); 125 126 logger.log(Level.FINE, "Got Manual Change status for "+ instanceId); 127 logger.log(Level.FINEST,"-------------------------------------"); 128 logger.log(Level.FINEST,mcs.toString()); 129 logger.log(Level.FINEST,"------------------------------------"); 130 ManualChangeManager.addManualChangeStatus(instanceId, mcs); 132 sleep(2000); } 137 catch (Exception e) { 138 logger.log(Level.WARNING, "core.error_getting_manual_changes", e); 142 } 143 } 144 145 } catch ( Exception ex ) {} 146 } 147 } 148 } 149 } 150 | Popular Tags |