forked from I2P_Developers/i2p.i2p
Console: Check wrapper version before calling WrapperManager.getProperties()
This commit is contained in:
@ -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) {
|
||||||
|
Reference in New Issue
Block a user