Console: Check wrapper version before calling WrapperManager.getProperties()

This commit is contained in:
zzz
2014-07-03 13:07:41 +00:00
parent aa3d3670a4
commit b95ec70d7d

View File

@ -25,6 +25,7 @@ public class ConfigServiceHandler extends FormHandler {
private static WrapperListener _wrapperListener; private static WrapperListener _wrapperListener;
private static final String LISTENER_AVAILABLE = "3.2.0"; private static final String LISTENER_AVAILABLE = "3.2.0";
private static final String PROPERTIES_AVAILABLE = "3.2.0";
/** /**
* Register two shutdown hooks, one to rekey and/or tell the wrapper we are stopping, * Register two shutdown hooks, one to rekey and/or tell the wrapper we are stopping,
@ -72,19 +73,20 @@ public class ConfigServiceHandler extends FormHandler {
ContextHelper.getContext(null).router().killKeys(); ContextHelper.getContext(null).router().killKeys();
if (_tellWrapper) { if (_tellWrapper) {
int wait = WAIT; int wait = WAIT;
// getProperties() not available on old wrappers, String wv = System.getProperty("wrapper.version");
// TODO find out what version and test if (wv != null && VersionComparator.comp(wv, PROPERTIES_AVAILABLE) >= 0) {
try { try {
Properties props = WrapperManager.getProperties(); Properties props = WrapperManager.getProperties();
String tmout = props.getProperty("wrapper.jvm_exit.timeout"); String tmout = props.getProperty("wrapper.jvm_exit.timeout");
if (tmout != null) { if (tmout != null) {
try { try {
int cwait = Integer.parseInt(tmout) * 1000; int cwait = Integer.parseInt(tmout) * 1000;
if (cwait > wait) if (cwait > wait)
wait = cwait; wait = cwait;
} catch (NumberFormatException nfe) {} } catch (NumberFormatException nfe) {}
} }
} catch (Throwable t) {} } catch (Throwable t) {}
}
WrapperManager.signalStopping(wait); WrapperManager.signalStopping(wait);
} }
} catch (Throwable t) { } catch (Throwable t) {