Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-5424 QM cleanup job #2987

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,12 @@ public WSEventController getEventController() {
public boolean isEnvironmentVariablesAccessible() {
return false;
}

protected void closeResource(String name, Runnable closeFunction) {
try {
closeFunction.run();
} catch (Exception e) {
log.error("Failed close " + name, e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
*/
package io.cloudbeaver.model.app;

import io.cloudbeaver.server.WebServerPreferenceStore;
import org.jkiss.code.NotNull;

import java.util.Map;

/**
* Web server configuration.
* Contains only server configuration properties.
Expand All @@ -27,4 +32,12 @@
return "";
}

/**

Check warning on line 35 in server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/WebServerConfiguration.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/WebServerConfiguration.java#L35

Summary javadoc is missing.
* @return the setting values that will be used in {@link WebServerPreferenceStore}
*/
@NotNull
alexander-skoblikov marked this conversation as resolved.
Show resolved Hide resolved
default Map<String, Object> getProductSettings() {
return Map.of();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,20 @@
*/
package io.cloudbeaver.server;

import io.cloudbeaver.utils.WebAppUtils;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.impl.preferences.AbstractPreferenceStore;
import org.jkiss.dbeaver.model.preferences.DBPPreferenceStore;

import java.io.IOException;
import java.util.Map;

public class CBPreferenceStore extends AbstractPreferenceStore {
@NotNull
private final CBPlatform cbPlatform;
public class WebServerPreferenceStore extends AbstractPreferenceStore {
private final DBPPreferenceStore parentStore;

public CBPreferenceStore(
@NotNull CBPlatform cbPlatform,
public WebServerPreferenceStore(
@NotNull DBPPreferenceStore parentStore
) {
this.cbPlatform = cbPlatform;
this.parentStore = parentStore;
}

Expand Down Expand Up @@ -188,7 +185,7 @@ public void save() throws IOException {
}

private Map<String, Object> productConf() {
var app = cbPlatform.getApplication();
return app.getProductConfiguration();
var app = WebAppUtils.getWebApplication();
return app.getServerConfiguration().getProductSettings();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class CBPlatform extends BaseGQLPlatform {
@Nullable
private static GQLApplicationAdapter application = null;

private CBPreferenceStore preferenceStore;
private WebServerPreferenceStore preferenceStore;
protected final List<DBPDriver> applicableDrivers = new ArrayList<>();

public static CBPlatform getInstance() {
Expand All @@ -77,7 +77,7 @@ public static void setApplication(@NotNull GQLApplicationAdapter application) {
protected synchronized void initialize() {
long startTime = System.currentTimeMillis();
log.info("Initialize web platform...: ");
this.preferenceStore = new CBPreferenceStore(this, WebPlatformActivator.getInstance().getPreferences());
this.preferenceStore = new WebServerPreferenceStore(WebPlatformActivator.getInstance().getPreferences());
super.initialize();
refreshApplicableDrivers();

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.app.DBPPlatform;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.runtime.PeriodicJob;

public class SessionStateJob extends PeriodicSystemJob {
public class SessionStateJob extends PeriodicJob {
private static final Log log = Log.getLog(SessionStateJob.class);
private static final int PERIOD_MS = 30_000; // once per 30 seconds
private final WebSessionManager sessionManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.app.DBPPlatform;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.runtime.PeriodicJob;

/**
* WebSessionMonitorJob
*/
public class WebSessionMonitorJob extends PeriodicSystemJob {
public class WebSessionMonitorJob extends PeriodicJob {
private static final Log log = Log.getLog(WebSessionMonitorJob.class);
private static final int MONITOR_INTERVAL = 10000; // once per 10 seconds
private final WebSessionManager sessionManager;
Expand Down