DataStoreJobCoordinator super minor LOG related performance fix 90/49490/4
authorMichael Vorburger <vorburger@redhat.com>
Fri, 16 Dec 2016 17:01:18 +0000 (18:01 +0100)
committerDavid Suarez <david.suarez.fuentes@ericsson.com>
Mon, 19 Dec 2016 16:54:38 +0000 (16:54 +0000)
LOG statements, especially trace(), should not do object creation, and
in this particular case, it seems not necessary to transform the Set to
an Array to a String... Set has a suitable toString, so not sure why
this was thought to be necessary; it should be just fine like this.

PS: Found while staring at DataStoreJobCoordinator for async test
infra.. I still can't complete make sense of what this class really
does! (Thus nor how to sanely make it testable.)

Change-Id: I27593b5ca0a5afe1784be23bc49b3fc231aaee51
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/datastoreutils/DataStoreJobCoordinator.java

index cfbc731eaa4e026a3c7fee2745e1304d1787cfcb..82541205b83d120d9998bf239da1c8a59934e86f 100755 (executable)
@@ -11,7 +11,6 @@ package org.opendaylight.genius.datastoreutils;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
-import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -180,7 +179,7 @@ public class DataStoreJobCoordinator {
                 scheduledExecutorService.schedule(() -> {
                     MainTask worker = new MainTask(jobEntry);
                     fjPool.execute(worker);
-                    }, waitTime, TimeUnit.MILLISECONDS);
+                }, waitTime, TimeUnit.MILLISECONDS);
                 return;
             }
 
@@ -288,7 +287,7 @@ public class DataStoreJobCoordinator {
                             continue;
                         }
                         LOG.trace("JobQueueHandler handling queue {} with kesy size {}. Keys: {} ", i,
-                                jobEntriesMap.size(), Arrays.toString(jobEntriesMap.keySet().toArray()));
+                                jobEntriesMap.size(), jobEntriesMap.keySet());
 
                         synchronized (jobEntriesMap) {
                             Iterator<Map.Entry<String, JobQueue>> it = jobEntriesMap.entrySet().iterator();