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

Database connection pool refactoring #176

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions etc/storm.properties.template
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ storm.service.SURL.default-ports =
# Parameters to connect to the DB used as channel for the requests.
storm.service.request-db.host =
storm.service.request-db.username =
storm.service.request-db.passwd =
storm.service.request-db.passwd =
# Added v1.12.0
storm.service.request-db.port =

#############################################
############ PROFILE PARAMETERS ############
Expand Down Expand Up @@ -106,7 +108,12 @@ default.storagetype = P
# ============================
persistence.internal-db.connection-pool.maxActive = 50
persistence.internal-db.connection-pool.maxWait = 50

persistence.internal-db.connection-pool.size = 50
# Added with 1.12.0:
persistence.internal-db.connection-pool.minIdle = 10
persistence.internal-db.connection-pool.maxWaitMillis = -1
persistence.internal-db.connection-pool.testOnBorrow = true
persistence.internal-db.connection-pool.testWhileIdle = true

# ============================
# ASYNCH SCHEDULER Component parameters
Expand All @@ -132,8 +139,8 @@ scheduler.chunksched.copy.queueSize=500
# ============================
# ASYNCH PICKER Component parameters
# ============================
asynch.db.ReconnectPeriod=18000
asynch.db.DelayPeriod=30
asynch.db.ReconnectPeriod=18000 # removed since v1.12.0
asynch.db.DelayPeriod=30 # removed since v1.12.0
asynch.PickingInitialDelay=1
# Polling time in seconds for pick up new requests from DB
asynch.PickingTimeInterval=2
Expand Down
39 changes: 38 additions & 1 deletion src/main/java/it/grid/storm/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,57 @@

import static java.lang.System.exit;

import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;

import org.apache.commons.configuration.ConfigurationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;

import it.grid.storm.config.Configuration;
import it.grid.storm.namespace.Namespace;
import it.grid.storm.namespace.NamespaceException;
import it.grid.storm.startup.Bootstrap;
import it.grid.storm.startup.BootstrapException;

public class Main {

private static final Logger log = LoggerFactory.getLogger(Main.class);

public static final String DEFAULT_CONFIG_DIR = "/etc/storm/backend-server";
public static final String DEFAULT_CONFIG_FILE = DEFAULT_CONFIG_DIR + "/storm.properties";
public static final String DEFAULT_NAMESPACE_FILE = DEFAULT_CONFIG_DIR + "/namespace.xml";
public static final String DEFAULT_NAMESPACE_SCHEMA_FILE =
DEFAULT_CONFIG_DIR + "/namespace-1.5.0.xsd";
public static final String DEFAULT_LOGGING_FILE = DEFAULT_CONFIG_DIR + "/logging.xml";

private Main() {}

public static void main(String[] args) {

StoRM storm = new StoRM();
log.info("Configure logging from {} ...", DEFAULT_LOGGING_FILE);
Bootstrap.configureLogging(DEFAULT_LOGGING_FILE);


log.info("Load configuration from {} ...", DEFAULT_CONFIG_FILE);
try {
Configuration.init(DEFAULT_CONFIG_FILE);
} catch (IOException | ConfigurationException e) {
log.error(e.getMessage(), e);
exit(1);
}

log.info("Load namespace from {} ...", DEFAULT_NAMESPACE_FILE);
try {
Namespace.init(DEFAULT_NAMESPACE_FILE, true);
} catch (RuntimeException | NamespaceException | ConfigurationException | ParserConfigurationException | SAXException | IOException e) {
log.error(e.getMessage(), e);
exit(1);
}

StoRM storm = new StoRM(Configuration.getInstance(), Namespace.getInstance());

try {
storm.init();
Expand Down
Loading