Code example for AtomicReference

Methods: set

0
    private void createKeyStore() { 
        // Whenever the key store changes, we need to set the ref to null 
        // so we don't pass stale versions of the key manager factory  
        // to callers. 
         
        this.keyManagerFactoryRef.set(null);
        final String dummyId = String.valueOf(RandomUtils.nextInt());
        // Generate the keystore using a dummy ID. 
        log.debug("Dummy ID is: {}", dummyId);
        log.debug("Creating keystore..."); 
         
        String result = LanternUtils.runKeytool("-genkey", 
            "-alias", dummyId, 
            "-keysize", KEYSIZE, 
            "-validity", "365",  
            "-keyalg", ALG, 
            "-dname", "CN="+dummyId, 
            "-keypass", PASS, 
            "-storepass", PASS, 
            "-keystore", KEYSTORE_FILE.getAbsolutePath());