[MINOR] Singleton Federated SSL context
diff --git a/src/main/java/org/apache/sysds/runtime/controlprogram/federated/FederatedData.java b/src/main/java/org/apache/sysds/runtime/controlprogram/federated/FederatedData.java
index 67f16e2..1713ff1 100644
--- a/src/main/java/org/apache/sysds/runtime/controlprogram/federated/FederatedData.java
+++ b/src/main/java/org/apache/sysds/runtime/controlprogram/federated/FederatedData.java
@@ -58,16 +58,8 @@
 	private static final Log LOG = LogFactory.getLog(FederatedData.class.getName());
 	private static final Set<InetSocketAddress> _allFedSites = new HashSet<>();
 
-	private static SslContext sslCtx;
-	
-	static {
-		try {
-			sslCtx = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build();
-		}
-		catch(SSLException e) {
-			LOG.error("Static SSL setup failed for client side");
-		}
-	}
+	/** A Singleton constructed SSL context, that only is assigned if ssl is enabled. */
+	private static SslContextMan instance = null;
 
 	private final Types.DataType _dataType;
 	private final InetSocketAddress _address;
@@ -178,8 +170,8 @@
 				protected void initChannel(SocketChannel ch) throws Exception {
 					ChannelPipeline cp = ch.pipeline();
 					if(ConfigurationManager.getDMLConfig().getBooleanValue(DMLConfig.USE_SSL_FEDERATED_COMMUNICATION)) {
-						cp.addLast(
-							sslCtx.newHandler(ch.alloc(), address.getAddress().getHostAddress(), address.getPort()));
+						cp.addLast(SslConstructor().context
+							.newHandler(ch.alloc(), address.getAddress().getHostAddress(), address.getPort()));
 					}
 
 					cp.addLast("ObjectDecoder",
@@ -190,10 +182,10 @@
 
 				}
 			});
-			
+
 			ChannelFuture f = b.connect(address).sync();
 			Promise<FederatedResponse> promise = f.channel().eventLoop().newPromise();
-			
+
 			handler.setPromise(promise);
 			f.channel().writeAndFlush(request);
 			return promise;
@@ -254,6 +246,28 @@
 		}
 	}
 
+	private static class SslContextMan {
+		protected final SslContext context;
+
+		private SslContextMan() {
+			try {
+				context = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build();
+			}
+			catch(SSLException e) {
+				throw new DMLRuntimeException("Static SSL setup failed for client side", e);
+			}
+		}
+	}
+
+	private static SslContextMan SslConstructor() {
+		if(instance == null) {
+			return new SslContextMan();
+		}
+		else {
+			return instance;
+		}
+	}
+
 	@Override
 	public String toString() {
 		StringBuilder sb = new StringBuilder();