Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,16 @@ protected void doOpen() throws Exception {

karafRealm = new KarafRealm(bundleContext, config);
register(JaasRealm.class, karafRealm);

autoEncryptionSupport = new AutoEncryptionSupport(config);
if (Boolean.parseBoolean((String) config.get(ENCRYPTION_ENABLED))) {
autoEncryptionSupport = new AutoEncryptionSupport(config);
}
}

@Override
protected void doStop() {
StreamUtils.close(autoEncryptionSupport);
if (autoEncryptionSupport != null) {
autoEncryptionSupport.close();
}
super.doStop();
LDAPCache.clear();
}
Expand All @@ -89,9 +92,12 @@ protected void reconfigure() {
karafRealm.updated(config);
}
if (autoEncryptionSupport != null) {
StreamUtils.close(autoEncryptionSupport);
autoEncryptionSupport.close();
autoEncryptionSupport = null;
}
if (Boolean.parseBoolean((String) config.get(ENCRYPTION_ENABLED))) {
autoEncryptionSupport = new AutoEncryptionSupport(config);
}
autoEncryptionSupport = new AutoEncryptionSupport(config);
}

private Map<String, Object> getConfig() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
public class AutoEncryptionSupport implements Runnable, Closeable {

private final Logger LOGGER = LoggerFactory.getLogger(AutoEncryptionSupport.class);
boolean running;
private volatile EncryptionSupport encryptionSupport;
private volatile boolean running;
private EncryptionSupport encryptionSupport;
private ExecutorService executor;

public AutoEncryptionSupport(Map<String, Object> properties) {
running = true;
this.encryptionSupport = new EncryptionSupport(properties);
encryptionSupport = new EncryptionSupport(properties);
executor = Executors.newSingleThreadExecutor();
executor.execute(this);
}
Expand Down