summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java
diff options
context:
space:
mode:
authorSimon Rettberg2015-09-09 12:30:00 +0200
committerSimon Rettberg2015-09-09 12:30:00 +0200
commit901a36d6056ed6ab5ca32f6b4cef0b5589ed720e (patch)
tree113e335c1ed462c84525c3fcccf607385e1eadeb /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java
parent[server] Debug code for mail gen (diff)
downloadtutor-module-901a36d6056ed6ab5ca32f6b4cef0b5589ed720e.tar.gz
tutor-module-901a36d6056ed6ab5ca32f6b4cef0b5589ed720e.tar.xz
tutor-module-901a36d6056ed6ab5ca32f6b4cef0b5589ed720e.zip
[server] Make master server ssl/port configurable
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java')
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java
index 6a4b14c2..425a3384 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java
@@ -4,7 +4,9 @@ import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.sql.SQLException;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import javax.net.ssl.SSLContext;
@@ -40,6 +42,8 @@ public class App {
public static boolean DEBUG = false;
+ private static final Set<String> failFastMethods = new HashSet<>();
+
public static void main(String[] args) throws TTransportException, NoSuchAlgorithmException, IOException {
//get going and show basic information in log file
BasicConfigurator.configure();
@@ -64,10 +68,16 @@ public class App {
System.exit(1);
}
+ failFastMethods.add("getVirtualizers");
+ failFastMethods.add("getOperatingSystems");
+ failFastMethods.add("getOrganizations");
+
ThriftManager.setMasterErrorCallback(new ErrorCallback() {
@Override
public boolean thriftError(int failCount, String method, Throwable t) {
+ if (failFastMethods.contains(method))
+ return false;
if (failCount > 2 || t == null || !(t instanceof TTransportException)) {
LOGGER.warn("Thrift Client error for " + method + ", FAIL.");
return false;
@@ -82,8 +92,12 @@ public class App {
}
});
- ThriftManager.setMasterServerAddress(SSLContext.getDefault(), // TODO: Use the TLSv1.2 one once the master is ready
- Configuration.getMasterServerAddress(), 9091, 30000);
+ SSLContext ctx = null;
+ if (Configuration.getMasterServerSsl()) {
+ ctx = SSLContext.getDefault();
+ }
+ ThriftManager.setMasterServerAddress(ctx, // TODO: Use the TLSv1.2 one once the master is ready
+ Configuration.getMasterServerAddress(), Configuration.getMasterServerPort(), 30000);
// Load useful things from master server
OrganizationList.get();