Do not intern strings passed to JobCoordinator 08/82608/2
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 20 Jun 2019 18:06:55 +0000 (20:06 +0200)
committerStephen Kitt <skitt@redhat.com>
Fri, 21 Jun 2019 10:42:31 +0000 (10:42 +0000)
JobCoordinator is using key equality, not identity, to determine
where to put a particular job -- which means String.intern() is
completely unnecessary.

Change-Id: I29c805608a731f2775c06c661084f64c6e1847ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/AbstractAclServiceImpl.java
aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/listeners/AclInterfaceStateListener.java
aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/utils/AclServiceUtils.java

index cbf4d4b9958706208380945ca1bba8c88b5c0001..8dd955ced5450b22845348d382c994e982f47902 100644 (file)
@@ -242,7 +242,7 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
 
     private void handleAclChange(List<FlowEntity> flowEntries, AclInterface port, List<Uuid> aclList,
             int addOrRemove) {
-        int operationForAclRules = (addOrRemove == NwConstants.DEL_FLOW) ? NwConstants.MOD_FLOW : addOrRemove;
+        int operationForAclRules = addOrRemove == NwConstants.DEL_FLOW ? NwConstants.MOD_FLOW : addOrRemove;
         programAclRules(flowEntries, port, aclList, operationForAclRules);
         updateRemoteAclFilterTable(flowEntries, port, aclList, port.getAllowedAddressPairs(), addOrRemove);
         programAclDispatcherTable(flowEntries, port, addOrRemove);
@@ -469,7 +469,7 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
             List<MatchInfoBase> matches, Integer priority) {
         AceIp acl = (AceIp) ace.getMatches().getAceType();
         final String newFlowName = flowName + this.directionString + "_" + port.getDpId() + "_" + port.getLPortTag()
-                + "_" + ((acl.getAceIpVersion() instanceof AceIpv4) ? "_IPv4" : "_IPv6") + "_FlowAfterRuleDeleted";
+                + "_" + (acl.getAceIpVersion() instanceof AceIpv4 ? "_IPv4" : "_IPv6") + "_FlowAfterRuleDeleted";
 
         final List<MatchInfoBase> newMatches =
                 matches.stream().filter(obj -> !(obj instanceof NxMatchCtState || obj instanceof MatchMetadata))
@@ -481,7 +481,7 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
                 AclServiceUtils.createCtMarkInstructionForNewState(getAclFilterCumDispatcherTable(), port.getElanId());
         // Reversing the flow add/delete operation for this table.
         List<FlowEntity> flowEntries = new ArrayList<>();
-        int operation = (addOrRemove == NwConstants.ADD_FLOW) ? NwConstants.DEL_FLOW : NwConstants.ADD_FLOW;
+        int operation = addOrRemove == NwConstants.ADD_FLOW ? NwConstants.DEL_FLOW : NwConstants.ADD_FLOW;
         addFlowEntryToList(flowEntries, port.getDpId(), getAclForExistingTrafficTable(), newFlowName, priority, 0,
                 AclServiceUtils.getHardTimoutForApplyStatefulChangeOnExistingTraffic(ace, aclServiceUtils),
                 AclConstants.COOKIE_ACL_BASE, newMatches, instructions, operation);
@@ -757,7 +757,7 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
                     syncRemoteAclTable(flowEntries, portId, aclId, aclTag, aaps, addOrRemove);
                 }
                 else if (addOrRemove == NwConstants.DEL_FLOW) {
-                    jobCoordinator.enqueueJob(aclId.getValue().intern(), () -> {
+                    jobCoordinator.enqueueJob(aclId.getValue(), () -> {
                         List<FlowEntity> remoteTableFlowEntries = new ArrayList<>();
                         syncRemoteAclTable(remoteTableFlowEntries, portId, aclId, aclTag, aaps, addOrRemove);
                         programFlows(AclConstants.ACL_JOB_KEY_PREFIX + aclId.getValue(),
index 929222ef9db5890ec10adde38dab9a58bb705f37..c9ac31dbb366967c7b636bd5c966c4c8ecf43585 100644 (file)
@@ -109,7 +109,7 @@ public class AclInterfaceStateListener extends AsyncDataTreeChangeListenerBase<I
             }
             if (aclList != null) {
                 for (Uuid acl : aclList) {
-                    jobCoordinator.enqueueJob(acl.getValue().intern(), () -> {
+                    jobCoordinator.enqueueJob(acl.getValue(), () -> {
                         aclDataUtil.removeAclInterfaceMap(acl, aclInterface);
                         return Collections.emptyList();
                     });
index a5d3e7756d5e8a99c195f55443acaf9416c44ee4..704b68e5dce96ecb67a72cba8a0aa8d22c23813a 100644 (file)
@@ -1123,7 +1123,7 @@ public final class AclServiceUtils {
 
         for (Uuid aclId : aclList) {
             String aclName = aclId.getValue();
-            jobCoordinator.enqueueJob(aclName.intern(), () -> {
+            jobCoordinator.enqueueJob(aclName, () -> {
                 List<ListenableFuture<Void>> futures = new ArrayList<>();
                 futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, tx -> {
                     for (AllowedAddressPairs aap : allowedAddresses) {
@@ -1152,7 +1152,7 @@ public final class AclServiceUtils {
 
         for (Uuid aclId : aclList) {
             String aclName = aclId.getValue();
-            jobCoordinator.enqueueJob(aclName.intern(), () -> {
+            jobCoordinator.enqueueJob(aclName, () -> {
                 List<ListenableFuture<Void>> futures = new ArrayList<>();
                 futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, tx -> {
                     for (AllowedAddressPairs aap : allowedAddresses) {