org.redmine.ta.RedmineOptions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of redmine-java-api Show documentation
Show all versions of redmine-java-api Show documentation
Free open-source Java API for Redmine and Chiliproject bug/task management systems.
package org.redmine.ta;
/**
* Connection pooling options.
*
* @author maxkar
*
*/
public final class RedmineOptions {
private final int maxOpen;
private final int idleTimeout;
private final int evictionCheck;
/**
* Creates a new pooling config.
*
* @param maxOpen
* number of open connections.
* @param idleTimeout
* idle timeout in seconds.
* @param evictionCheck
* timeout between evictions checks in seconds.
*/
public RedmineOptions(int maxOpen, int idleTimeout,
int evictionCheck) {
this.maxOpen = maxOpen;
this.idleTimeout = idleTimeout;
this.evictionCheck = evictionCheck;
}
public static RedmineOptions simpleOptions() {
return new RedmineOptions(Integer.MAX_VALUE, 30, 30);
}
public static RedmineOptions withMaxConnections(int maxOpen) {
return new RedmineOptions(maxOpen, 30, 30);
}
public int getMaxOpenConnecitons() {
return maxOpen;
}
public int getIdleTimeout() {
return idleTimeout;
}
public int getEvictionCheckInterval() {
return evictionCheck;
}
}