1 4 package com.tc.config.schema.setup; 5 6 import org.apache.commons.lang.ArrayUtils; 7 8 import com.tc.config.schema.IllegalConfigurationChangeHandler; 9 import com.tc.config.schema.dynamic.ConfigItem; 10 import com.tc.logging.TCLogger; 11 import com.tc.logging.TCLogging; 12 13 24 public class FatalIllegalConfigurationChangeHandler implements IllegalConfigurationChangeHandler { 25 26 private static TCLogger logger; 27 28 private TCLogger getLogger() { 29 if(logger == null) { 30 logger = TCLogging.getLogger(FatalIllegalConfigurationChangeHandler.class); 31 } 32 33 return logger; 34 } 35 36 public void changeFailed(ConfigItem item, Object oldValue, Object newValue) { 37 String text = "Error: Terracotta is using an inconsistent configuration.\n\n" 38 + "The configuration that this client is using is different from the one used by\n" 39 + "the connected production server.\n\n" + "Specific information: " + item + " has changed.\n" 40 + " Old value: " + describe(oldValue) + "\n" + " New value: " + describe(newValue) + "\n"; 41 42 System.err.println(text); 43 getLogger().fatal(text); 44 System.exit(3); 45 } 46 47 private String describe(Object o) { 48 if (o == null) return "<null>"; 49 if (o.getClass().isArray()) return ArrayUtils.toString(o); 50 else return o.toString(); 51 } 52 53 } 54 | Popular Tags |