diff options
| author | Simon Rettberg | 2015-09-28 19:05:25 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2015-09-28 19:05:25 +0200 |
| commit | c34d27b744993b12191f1f85b062fc56d0a10ebc (patch) | |
| tree | 7a09ba30475544366b85715b6e8643f6f5f572f3 | |
| parent | [client] Cleanup no-SSL fallback for master server connection (diff) | |
| download | tutor-module-c34d27b744993b12191f1f85b062fc56d0a10ebc.tar.gz tutor-module-c34d27b744993b12191f1f85b062fc56d0a10ebc.tar.xz tutor-module-c34d27b744993b12191f1f85b062fc56d0a10ebc.zip | |
[client] Don't run proxy search if master server is reachable
| -rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java index 9a97181b..96659989 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java @@ -6,6 +6,10 @@ import java.text.MessageFormat; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.Priority; +import org.apache.thrift.TException; +import org.openslx.bwlp.thrift.iface.MasterServer; +import org.openslx.dozmod.App; +import org.openslx.thrifthelper.ThriftManager; import com.btr.proxy.search.ProxySearch; import com.btr.proxy.search.wpad.WpadProxySearchStrategy; @@ -29,6 +33,23 @@ public class ProxyConfigurator { * Initialization method. */ public static void init() { + MasterServer.Client masterClient = ThriftManager.getNewMasterClient(null, App.MASTER_SERVER_ADDRESS, + App.THRIFT_PORT, 4000); + if (masterClient != null) { + try { + masterClient.ping(); + try { + masterClient.getInputProtocol().getTransport().close(); + masterClient.getOutputProtocol().getTransport().close(); + } catch (Throwable e) { + } + } catch (TException e) { + masterClient = null; + } + } + // To be discussed: Let's bail out if the master server is reachable + if (masterClient != null) + return; // first setup the logger of proxy_vole com.btr.proxy.util.Logger.setBackend(new LogBackEnd() { |
