mirror of
https://github.com/opennetworkinglab/onos.git
synced 2026-05-05 04:06:49 +02:00
SONAR suggestions - concurrent access to static fields
Change-Id: I368c17d988ce70365b090bb420f59d50ff4eff67
This commit is contained in:
parent
5c7d488269
commit
074ba9b90f
@ -44,6 +44,7 @@ public final class AclRule {
|
||||
private final Action action;
|
||||
|
||||
protected static IdGenerator idGenerator;
|
||||
private static final Object ID_GENERATOR_LOCK = new Object();
|
||||
|
||||
/**
|
||||
* Enum type for ACL rule's action.
|
||||
@ -75,8 +76,10 @@ public final class AclRule {
|
||||
*/
|
||||
private AclRule(Ip4Prefix srcIp, Ip4Prefix dstIp, byte ipProto,
|
||||
short dstTpPort, Action action) {
|
||||
checkState(idGenerator != null, "Id generator is not bound.");
|
||||
this.id = RuleId.valueOf(idGenerator.getNewId());
|
||||
synchronized (ID_GENERATOR_LOCK) {
|
||||
checkState(idGenerator != null, "Id generator is not bound.");
|
||||
this.id = RuleId.valueOf(idGenerator.getNewId());
|
||||
}
|
||||
this.srcIp = srcIp;
|
||||
this.dstIp = dstIp;
|
||||
this.ipProto = ipProto;
|
||||
@ -225,8 +228,10 @@ public final class AclRule {
|
||||
* @param newIdGenerator id generator
|
||||
*/
|
||||
public static void bindIdGenerator(IdGenerator newIdGenerator) {
|
||||
checkState(idGenerator == null, "Id generator is already bound.");
|
||||
idGenerator = checkNotNull(newIdGenerator);
|
||||
synchronized (ID_GENERATOR_LOCK) {
|
||||
checkState(idGenerator == null, "Id generator is already bound.");
|
||||
idGenerator = checkNotNull(newIdGenerator);
|
||||
}
|
||||
}
|
||||
|
||||
public RuleId id() {
|
||||
|
||||
@ -26,8 +26,6 @@ import org.onosproject.cli.AbstractShellCommand;
|
||||
description = "Manages the SimpleFabric application")
|
||||
public class SimpleFabricCommand extends AbstractShellCommand {
|
||||
|
||||
protected static SimpleFabricService simpleFabric;
|
||||
|
||||
@Argument(index = 0, name = "command",
|
||||
description = "Command: show|intents|reactive-intents|refresh|flush",
|
||||
required = true, multiValued = false)
|
||||
@ -35,9 +33,9 @@ public class SimpleFabricCommand extends AbstractShellCommand {
|
||||
|
||||
@Override
|
||||
protected void execute() {
|
||||
if (simpleFabric == null) {
|
||||
simpleFabric = get(SimpleFabricService.class);
|
||||
}
|
||||
|
||||
SimpleFabricService simpleFabric = get(SimpleFabricService.class);
|
||||
|
||||
if (command == null) {
|
||||
print("command not found", command);
|
||||
return;
|
||||
|
||||
@ -30,7 +30,7 @@ import static org.onosproject.cli.AbstractShellCommand.get;
|
||||
*/
|
||||
public class VplsNameCompleter extends AbstractChoicesCompleter {
|
||||
|
||||
protected static Vpls vpls;
|
||||
protected Vpls vpls;
|
||||
|
||||
@Override
|
||||
public List<String> choices() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user