summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSHaselbauer <sarah.haselbauer@akquinet.de>2013-01-23 17:47:55 +0100
committerSHaselbauer <sarah.haselbauer@akquinet.de>2013-01-23 17:47:55 +0100
commit58102e97e16f9d89b2cedf789a3eb11d6c0a26fc (patch)
tree838e821e61018fc4ac144dc2cc413785c1b06870 /src
parent514da0237f6239322193d5d4b11b58fe4095da2b (diff)
downloadgitblit-58102e97e16f9d89b2cedf789a3eb11d6c0a26fc.tar.gz
gitblit-58102e97e16f9d89b2cedf789a3eb11d6c0a26fc.zip
alternative variant to disable thread creation by the scheduledExecutor in test selenium test cases
Diffstat (limited to 'src')
-rw-r--r--src/com/gitblit/GitBlit.java25
-rw-r--r--src/com/gitblit/GitBlitServer.java32
2 files changed, 37 insertions, 20 deletions
diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java
index f47e76ca..4cfd61e4 100644
--- a/src/com/gitblit/GitBlit.java
+++ b/src/com/gitblit/GitBlit.java
@@ -3096,13 +3096,7 @@ public class GitBlit implements ServletContextListener {
}
// schedule lucene engine
- boolean luceneIndexing = settings.getBoolean(Keys.web.allowLuceneIndexing, true);
- logger.info("Lucene indexing is " + (luceneIndexing ? "" : "not") + " activated");
-
- if (luceneIndexing) {
- scheduledExecutor.scheduleAtFixedRate(luceneExecutor, 1, 2, TimeUnit.MINUTES);
- logger.info("Lucene executor is scheduled to process indexed branches every 2 minutes.");
- }
+ enableLuceneIndexing();
// schedule gc engine
@@ -3184,6 +3178,23 @@ public class GitBlit implements ServletContextListener {
}
}
+ protected void enableLuceneIndexing() {
+ scheduledExecutor.scheduleAtFixedRate(luceneExecutor, 1, 2, TimeUnit.MINUTES);
+ logger.info("Lucene executor is scheduled to process indexed branches every 2 minutes.");
+ }
+
+ protected final Logger getLogger() {
+ return logger;
+ }
+
+ protected final ScheduledExecutorService getScheduledExecutor() {
+ return scheduledExecutor;
+ }
+
+ protected final LuceneExecutor getLuceneExecutor() {
+ return luceneExecutor;
+ }
+
private void logTimezone(String type, TimeZone zone) {
SimpleDateFormat df = new SimpleDateFormat("z Z");
df.setTimeZone(zone);
diff --git a/src/com/gitblit/GitBlitServer.java b/src/com/gitblit/GitBlitServer.java
index feddb93f..08c0d2a2 100644
--- a/src/com/gitblit/GitBlitServer.java
+++ b/src/com/gitblit/GitBlitServer.java
@@ -84,6 +84,8 @@ public class GitBlitServer {
private static Logger logger;
public static void main(String... args) {
+ GitBlitServer server = new GitBlitServer();
+
// filter out the baseFolder parameter
List<String> filtered = new ArrayList<String>();
String folder = "data";
@@ -108,16 +110,16 @@ public class GitBlitServer {
try {
jc.parse(filtered.toArray(new String[filtered.size()]));
if (params.help) {
- usage(jc, null);
+ server.usage(jc, null);
}
} catch (ParameterException t) {
- usage(jc, t);
+ server.usage(jc, t);
}
if (params.stop) {
- stop(params);
+ server.stop(params);
} else {
- start(params);
+ server.start(params);
}
}
@@ -127,7 +129,7 @@ public class GitBlitServer {
* @param jc
* @param t
*/
- private static void usage(JCommander jc, ParameterException t) {
+ protected final void usage(JCommander jc, ParameterException t) {
System.out.println(Constants.BORDER);
System.out.println(Constants.getGitBlitVersion());
System.out.println(Constants.BORDER);
@@ -147,7 +149,7 @@ public class GitBlitServer {
/**
* Stop Gitblt GO.
*/
- public static void stop(Params params) {
+ public void stop(Params params) {
try {
Socket s = new Socket(InetAddress.getByName("127.0.0.1"), params.shutdownPort);
OutputStream out = s.getOutputStream();
@@ -165,7 +167,7 @@ public class GitBlitServer {
/**
* Start Gitblit GO.
*/
- private static void start(Params params) {
+ protected final void start(Params params) {
final File baseFolder = new File(Params.baseFolder).getAbsoluteFile();
FileSettings settings = params.FILESETTINGS;
if (!StringUtils.isEmpty(params.settingsfile)) {
@@ -378,7 +380,7 @@ public class GitBlitServer {
server.setHandler(rootContext);
// Setup the GitBlit context
- GitBlit gitblit = GitBlit.self();
+ GitBlit gitblit = getGitBlitInstance();
gitblit.configureContext(settings, baseFolder, true);
rootContext.addEventListener(gitblit);
@@ -397,6 +399,10 @@ public class GitBlitServer {
System.exit(100);
}
}
+
+ protected GitBlit getGitBlitInstance() {
+ return GitBlit.self();
+ }
/**
* Creates an http connector.
@@ -405,7 +411,7 @@ public class GitBlitServer {
* @param port
* @return an http connector
*/
- private static Connector createConnector(boolean useNIO, int port) {
+ private Connector createConnector(boolean useNIO, int port) {
Connector connector;
if (useNIO) {
logger.info("Setting up NIO SelectChannelConnector on port " + port);
@@ -440,7 +446,7 @@ public class GitBlitServer {
* @param requireClientCertificates
* @return an https connector
*/
- private static Connector createSSLConnector(String certAlias, File keyStore, File clientTrustStore,
+ private Connector createSSLConnector(String certAlias, File keyStore, File clientTrustStore,
String storePassword, File caRevocationList, boolean useNIO, int port,
boolean requireClientCertificates) {
GitblitSslContextFactory factory = new GitblitSslContextFactory(certAlias,
@@ -474,7 +480,7 @@ public class GitBlitServer {
* @param port
* @return an ajp connector
*/
- private static Connector createAJPConnector(int port) {
+ private Connector createAJPConnector(int port) {
logger.info("Setting up AJP Connector on port " + port);
Ajp13SocketConnector ajp = new Ajp13SocketConnector();
ajp.setPort(port);
@@ -489,7 +495,7 @@ public class GitBlitServer {
*
* @return true if this is a windows machine
*/
- private static boolean isWindows() {
+ private boolean isWindows() {
return System.getProperty("os.name").toLowerCase().indexOf("windows") > -1;
}
@@ -548,7 +554,7 @@ public class GitBlitServer {
* JCommander Parameters class for GitBlitServer.
*/
@Parameters(separators = " ")
- private static class Params {
+ public static class Params {
public static String baseFolder;