/** * Creates a reloadable trustmanager. The trustmanager reloads itself * if the underlying trustore file has changed. * * @param type type of truststore file, typically 'jks'. * @param location local path to the truststore file. * @param password password of the truststore file. * @param reloadInterval interval to check if the truststore file has * changed, in milliseconds. * @throws IOException thrown if the truststore could not be initialized due * to an IO error. * @throws GeneralSecurityException thrown if the truststore could not be * initialized due to a security error. */ public ReloadingX509TrustManager(String type, String location, String password, long reloadInterval) throws IOException, GeneralSecurityException { this.type = type; file = new File(location); this.password = password; trustManagerRef = new AtomicReference<X509TrustManager>(); trustManagerRef.set(loadTrustManager()); this.reloadInterval = reloadInterval; }
@Override public void run() { while (running) { try { Thread.sleep(reloadInterval); } catch (InterruptedException e) { //NOP } if (running && needsReload()) { try { trustManagerRef.set(loadTrustManager()); } catch (Exception ex) { LOG.warn(RELOAD_ERROR_MESSAGE + ex.toString(), ex); } } } }
/** * Creates a reloadable trustmanager. The trustmanager reloads itself * if the underlying trustore file has changed. * * @param type type of truststore file, typically 'jks'. * @param location local path to the truststore file. * @param password password of the truststore file. * @param reloadInterval interval to check if the truststore file has * changed, in milliseconds. * @throws IOException thrown if the truststore could not be initialized due * to an IO error. * @throws GeneralSecurityException thrown if the truststore could not be * initialized due to a security error. */ public ReloadingX509TrustManager(String type, String location, String password, long reloadInterval) throws IOException, GeneralSecurityException { this.type = type; file = new File(location); this.password = password; trustManagerRef = new AtomicReference<X509TrustManager>(); trustManagerRef.set(loadTrustManager()); this.reloadInterval = reloadInterval; }
/** * Creates a reloadable trustmanager. The trustmanager reloads itself * if the underlying trustore file has changed. * * @param type type of truststore file, typically 'jks'. * @param location local path to the truststore file. * @param password password of the truststore file. * @param reloadInterval interval to check if the truststore file has * changed, in milliseconds. * @throws IOException thrown if the truststore could not be initialized due * to an IO error. * @throws GeneralSecurityException thrown if the truststore could not be * initialized due to a security error. */ public ReloadingX509TrustManager(String type, String location, String password, long reloadInterval) throws IOException, GeneralSecurityException { this.type = type; file = new File(location); this.password = password; trustManagerRef = new AtomicReference<X509TrustManager>(); trustManagerRef.set(loadTrustManager()); this.reloadInterval = reloadInterval; }
/** * Creates a reloadable trustmanager. The trustmanager reloads itself * if the underlying trustore file has changed. * * @param type type of truststore file, typically 'jks'. * @param location local path to the truststore file. * @param password password of the truststore file. * @param reloadInterval interval to check if the truststore file has * changed, in milliseconds. * @throws IOException thrown if the truststore could not be initialized due * to an IO error. * @throws GeneralSecurityException thrown if the truststore could not be * initialized due to a security error. */ public ReloadingX509TrustManager(String type, String location, String password, long reloadInterval) throws IOException, GeneralSecurityException { this.type = type; file = new File(location); this.password = password; trustManagerRef = new AtomicReference<X509TrustManager>(); trustManagerRef.set(loadTrustManager()); this.reloadInterval = reloadInterval; }
/** * Creates a reloadable trustmanager. The trustmanager reloads itself * if the underlying trustore file has changed. * * @param type type of truststore file, typically 'jks'. * @param location local path to the truststore file. * @param password password of the truststore file. * @param reloadInterval interval to check if the truststore file has * changed, in milliseconds. * @throws IOException thrown if the truststore could not be initialized due * to an IO error. * @throws GeneralSecurityException thrown if the truststore could not be * initialized due to a security error. */ public ReloadingX509TrustManager(String type, String location, String password, long reloadInterval) throws IOException, GeneralSecurityException { this.type = type; file = new File(location); this.password = password; trustManagerRef = new AtomicReference<X509TrustManager>(); trustManagerRef.set(loadTrustManager()); this.reloadInterval = reloadInterval; }
@Override public void run() { while (running) { try { Thread.sleep(reloadInterval); } catch (InterruptedException e) { //NOP } if (running && needsReload()) { try { trustManagerRef.set(loadTrustManager()); } catch (Exception ex) { LOG.warn(RELOAD_ERROR_MESSAGE + ex.toString(), ex); } } } }
@Override public void run() { while (running) { try { Thread.sleep(reloadInterval); } catch (InterruptedException e) { //NOP } if (running && needsReload()) { try { trustManagerRef.set(loadTrustManager()); } catch (Exception ex) { LOG.warn("Could not load truststore (keep using existing one) : " + ex.toString(), ex); } } } }
@Override public void run() { while (running) { try { Thread.sleep(reloadInterval); } catch (InterruptedException e) { //NOP } if (running && needsReload()) { try { trustManagerRef.set(loadTrustManager()); } catch (Exception ex) { LOG.warn("Could not load truststore (keep using existing one) : " + ex.toString(), ex); } } } }
@Override public void run() { while (running) { try { Thread.sleep(reloadInterval); } catch (InterruptedException e) { //NOP } if (running && needsReload()) { try { trustManagerRef.set(loadTrustManager()); } catch (Exception ex) { LOG.warn("Could not load truststore (keep using existing one) : " + ex.toString(), ex); } } } }