Commits

timemachine committed 0b5186e

Improved and resuse the system services summary desc.

  • Participants
  • Parent commits b2b037a
  • Branches 1.1.x

Comments (0)

Files changed (2)

File timemachine-scheduler/src/main/java/timemachine/scheduler/service/SchedulerEngine.java

 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.lang.StringUtils;
 
 		systemServiceContainer.init();
 		
 		if (logger.isInfoEnabled()) {
-			SchedulerNode node = systemServiceContainer.getSchedulerNodeService().getSchedulerNode();
-			String configUrlDesc = systemServiceContainer.getConfigPropsService().getConfigUrl();
-			if (configUrlDesc == null)
-				configUrlDesc = "DEFAULT";
-			StringBuilder sb = new StringBuilder("[\n");
-			sb.append("  scheduler: " + node.getSchedulerData()).append(",\n");
-			sb.append("  schedulerNode: " + node).append(",\n");
-			sb.append("  configProps: " + configUrlDesc).append(",\n");
-			sb.append("  dataStore: " + systemServiceContainer.getDataStoreService()).append(",\n");
-			sb.append("  scheduleRunner: " + systemServiceContainer.getScheduleRunnerService()).append(",\n");
-			sb.append("  classLoader: " + systemServiceContainer.getClassLoaderService()).append(",\n");
-			sb.append("  jobTaskFactory: " + systemServiceContainer.getJobTaskFactoryService()).append(",\n");
-			sb.append("  jobTaskPoolNameResolver: " + systemServiceContainer.getJobTaskPoolNameResolverService()).append(",\n");
-			for (Map.Entry<String, ThreadPool> entry : systemServiceContainer.getJobTaskThreadPoolServices().entrySet()) {
-				sb.append("  jobTaskThreadPool: " + entry.getValue()).append(",\n");
-			}
-			sb.append("]");
-			logger.info("TimeScheduler system services initialized: " + sb.toString());
+			logger.info("TimeScheduler system services initialized: " + systemServiceContainer.getSummaryDesc());
 		}
 		
 		// Populate private members for this class to use.

File timemachine-scheduler/src/main/java/timemachine/scheduler/service/SystemServiceContainer.java

 import timemachine.scheduler.SchedulerContext;
 import timemachine.scheduler.SchedulerException;
 import timemachine.scheduler.SchedulerListener;
+import timemachine.scheduler.SchedulerNode;
 import timemachine.scheduler.Service;
 
 /**
 		// Note: do not add scheduler instance into the container b/c we don't want it to auto manage life-cycles.
 		this.scheduler = scheduler;
 	}
+	
+	public String getSummaryDesc() {
+		SchedulerNode node = getSchedulerNodeService().getSchedulerNode();
+		String configUrlDesc = getConfigPropsService().getConfigUrl();
+		if (configUrlDesc == null)
+			configUrlDesc = ConfigPropsService.DEFAULT_CONFIG_FILE;
+		StringBuilder sb = new StringBuilder("[\n");
+		sb.append("  scheduler: " + node.getSchedulerData()).append(",\n");
+		sb.append("  schedulerNode: " + node).append(",\n");
+		sb.append("  configProps: " + configUrlDesc).append(",\n");
+		sb.append("  dataStore: " + getDataStoreService()).append(",\n");
+		sb.append("  scheduleRunner: " + getScheduleRunnerService()).append(",\n");
+		sb.append("  classLoader: " + getClassLoaderService()).append(",\n");
+		sb.append("  jobTaskFactory: " + getJobTaskFactoryService()).append(",\n");
+		sb.append("  jobTaskPoolNameResolver: " + getJobTaskPoolNameResolverService()).append(",\n");
+		for (Map.Entry<String, ThreadPool> entry : getJobTaskThreadPoolServices().entrySet()) {
+			sb.append("  jobTaskThreadPool: " + entry.getValue()).append(",\n");
+		}
+		sb.append("]");
+		return sb.toString();
+	}
 
 	/** Check to see if given service implements listener that this container may provide injection for. */
 	public void injectServiceListeners(Service service) {