@@ -0,0 +1,3833 @@
+/*! ******************************************************************************%0A *%0A * Pentaho Data Integration%0A *%0A * Copyright (C) 2002-2016 by Pentaho : http://www.pentaho.com%0A *%0A *******************************************************************************%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with%0A * the License. You may obtain a copy of the License at%0A *%0A *    http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A *%0A ******************************************************************************/%0A%0Apackage org.pentaho.di.cluster;%0A%0Aimport org.apache.commons.httpclient.HttpClient;%0Aimport org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;%0A%0Aimport javax.net.ssl.KeyManager;%0Aimport javax.net.ssl.SSLContext;%0Aimport javax.net.ssl.X509TrustManager;%0Aimport java.security.SecureRandom;%0Aimport java.security.cert.CertificateException;%0Aimport java.security.cert.X509Certificate;%0A%0A/**%0A * Encapsulates the Apache commons HTTP connection manager with a singleton. We can use this to limit the number of open%0A * connections to slave servers.%0A *%0A * @author matt%0A */%0Apublic class SlaveConnectionManager %7B%0A%0A    private static final String SSL = %22SSL%22;%0A    private static final String KEYSTORE_SYSTEM_PROPERTY = %22javax.net.ssl.keyStore%22;%0A%0A    private static SlaveConnectionManager slaveConnectionManager;%0A%0A    private MultiThreadedHttpConnectionManager manager;%0A%0A    private SlaveConnectionManager() %7B%0A        if (needToInitializeSSLContext()) %7B%0A            try %7B%0A                SSLContext context = SSLContext.getInstance(SSL);%0A                context.init(new KeyManager%5B0%5D, new X509TrustManager%5B%5D%7BgetDefaultTrustManager()%7D, new SecureRandom());%0A                SSLContext.setDefault(context);%0A            %7D catch (Exception e) %7B%0A                //log.logError( %22Default SSL context hasn't been initialized%22, e );%0A            %7D%0A        %7D%0A        manager = new MultiThreadedHttpConnectionManager();%0A        manager.getParams().setDefaultMaxConnectionsPerHost(100);%0A        manager.getParams().setMaxTotalConnections(200);%0A    %7D%0A%0A    private static boolean needToInitializeSSLContext() %7B%0A        return System.getProperty(KEYSTORE_SYSTEM_PROPERTY) == null;%0A    %7D%0A%0A    public static SlaveConnectionManager getInstance() %7B%0A        if (slaveConnectionManager == null) %7B%0A            slaveConnectionManager = new SlaveConnectionManager();%0A        %7D%0A        return slaveConnectionManager;%0A    %7D%0A%0A    public HttpClient createHttpClient() %7B%0A        return new HttpClient(manager);%0A    %7D%0A%0A    public void shutdown() %7B%0A        manager.shutdown();%0A    %7D%0A%0A    private static X509TrustManager getDefaultTrustManager() %7B%0A        return new X509TrustManager() %7B%0A            @Override%0A            public void checkClientTrusted(X509Certificate%5B%5D certs, String param) throws CertificateException %7B%0A            %7D%0A%0A            @Override%0A            public void checkServerTrusted(X509Certificate%5B%5D certs, String param) throws CertificateException %7B%0A                for (X509Certificate cert : certs) %7B%0A                    cert.checkValidity(); // validate date%0A                    // cert.verify( key ); // check by Public key%0A                    // cert.getBasicConstraints()!=-1 // check by CA%0A                %7D%0A            %7D%0A%0A            @Override%0A            public X509Certificate%5B%5D getAcceptedIssuers() %7B%0A                return null;%0A            %7D%0A        %7D;%0A    %7D%0A%0A    static void reset() %7B%0A        slaveConnectionManager = null;%0A    %7D%0A%7D%0A

Add formatted SlaveConnectionManager