From 43772d71253d3abe58bdc78f7046106afbb232eb Mon Sep 17 00:00:00 2001 From: Yuta HIGUCHI Date: Wed, 3 Dec 2014 13:57:09 -0800 Subject: [PATCH] HazelcastIntentStore: fix checkstyle issue Change-Id: I1a912e44dbaa6798095ebec17d61f4a3074d6004 --- .../intent/impl/HazelcastIntentStore.java | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/HazelcastIntentStore.java b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/HazelcastIntentStore.java index 99b7b0fe8b..343a33e9ca 100644 --- a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/HazelcastIntentStore.java +++ b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/HazelcastIntentStore.java @@ -374,8 +374,6 @@ public class HazelcastIntentStore } } - // TODO slice out methods after merging Ali's patch - // CHECKSTYLE IGNORE MethodLength FOR NEXT 1 LINES @Override public List batchWrite(BatchWrite batch) { // Hazelcast version will never fail for conditional failure now. @@ -384,6 +382,18 @@ public class HazelcastIntentStore List>>> futures = new ArrayList<>(batch.operations().size()); List events = Lists.newArrayList(); + batchWriteAsync(batch, failed, futures); + + // verify result + verifyAsyncWrites(futures, failed, events); + + notifyDelegate(events); + + return failed; + } + + private void batchWriteAsync(BatchWrite batch, List failed, + List>>> futures) { for (Operation op : batch.operations()) { switch (op.type()) { case CREATE_INTENT: @@ -437,8 +447,18 @@ public class HazelcastIntentStore break; } } + } - // verify result + /** + * Checks the async write result Futures and prepare Events to post. + * + * @param futures async write Futures + * @param failed list to output failed batch write operations + * @param events list to output events to post as result of writes + */ + private void verifyAsyncWrites(List>>> futures, + List failed, + List events) { for (Pair>> future : futures) { final Operation op = future.getLeft(); final List> subops = future.getRight(); @@ -582,10 +602,6 @@ public class HazelcastIntentStore break; } } - - notifyDelegate(events); - - return failed; } public final class RemoteIntentStateListener extends EntryAdapter {