Merge "Stop using deprecated APIs"

This commit is contained in:
Zuul 2024-01-02 12:54:05 +00:00 committed by Gerrit Code Review
commit a06c685f5c
3 changed files with 18 additions and 6 deletions

View File

@ -56,8 +56,8 @@ public class Utils {
return val;
}
public static boolean getBoolean(Map<String, String> parameters, String paramName, boolean paramDefaultValue, final StorletLogger log) {
String paramValue = getParam(parameters, paramName, (new Boolean(paramDefaultValue)).toString(), log, Boolean.FALSE);
public static boolean getBoolean(Map<String, String> parameters, String paramName, boolean defaultValue, final StorletLogger log) {
String paramValue = getParam(parameters, paramName, Boolean.toString(defaultValue), log, Boolean.FALSE);
return Boolean.parseBoolean(paramValue);
}

View File

@ -28,6 +28,7 @@ import org.openstack.storlet.sbus.SBusBackend.eLogLevel;
public class SBus {
private SBusHandler hServerSideSBus_;
private SBusBackend SBusBack_;
private String ContainerId_;
/*------------------------------------------------------------------------
* CTOR
@ -36,7 +37,7 @@ public class SBus {
* */
public SBus(final String contId) throws IOException {
SBusBack_ = new SBusBackend();
SBusBack_.startLogger(eLogLevel.SBUS_LOG_DEBUG, contId);
ContainerId_ = contId;
}
/*------------------------------------------------------------------------
@ -77,11 +78,20 @@ public class SBus {
}
/*------------------------------------------------------------------------
* DTOR
* startLogger
*
* Start logging
* */
public void startLogger() {
SBusBack_.startLogger(eLogLevel.SBUS_LOG_DEBUG, ContainerId_);
}
/*------------------------------------------------------------------------
* stopLogger
*
* Stop logging
* */
public void finalize() {
public void stopLogger() {
SBusBack_.stopLogger();
}
}

View File

@ -65,7 +65,7 @@ public class SDaemon {
IStorlet storlet = null;
try {
Class<?> c = Class.forName(strStorletClassName);
storlet = (IStorlet) c.newInstance();
storlet = (IStorlet) c.getDeclaredConstructor().newInstance();
} catch (Exception e) {
logger_.error(strStorletName_ + ": Failed to load storlet class "
+ strStorletClassName + "class path is "
@ -126,6 +126,7 @@ public class SDaemon {
storletTaskFactory_ = new STaskFactory(storlet, logger_);
logger_.trace("Instanciating SBus");
sbus_ = new SBus(strContId);
sbus_.startLogger();
try {
logger_.trace("Initialising SBus");
sbus_.create(strSBusPath);
@ -214,5 +215,6 @@ public class SDaemon {
logger_.info(strStorletName_ + ": Daemon for storlet " + strStorletName_ +
" is going down...");
sExecManager_.terminate();
sbus_.stopLogger();
}
}