import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;
private static final Logger logger = Logging.getLogger(FcpInterface.class);
/** Whether the FCP interface is currently active. */
- private volatile boolean active;
+ private final AtomicBoolean active = new AtomicBoolean();
/** What function full access is required for. */
private volatile FullAccessRequired fullAccessRequired = FullAccessRequired.ALWAYS;
@VisibleForTesting
boolean isActive() {
- return active;
+ return active.get();
}
/**
* deactivate the FCP interface
*/
public void setActive(boolean active) {
- this.active = active;
+ this.active.set(active);
}
@VisibleForTesting
* {@link FredPluginFCP#ACCESS_FCP_RESTRICTED}
*/
public void handle(PluginReplySender pluginReplySender, SimpleFieldSet parameters, Bucket data, int accessType) {
- if (!active) {
+ if (!active.get()) {
try {
sendReply(pluginReplySender, null, new ErrorResponse(400, "FCP Interface deactivated"));
} catch (PluginNotFoundException pnfe1) {