Yuta HIGUCHI

HazelcastIntentStore: fix checkstyle issue

Change-Id: I1a912e44dbaa6798095ebec17d61f4a3074d6004
...@@ -374,8 +374,6 @@ public class HazelcastIntentStore ...@@ -374,8 +374,6 @@ public class HazelcastIntentStore
374 } 374 }
375 } 375 }
376 376
377 - // TODO slice out methods after merging Ali's patch
378 - // CHECKSTYLE IGNORE MethodLength FOR NEXT 1 LINES
379 @Override 377 @Override
380 public List<Operation> batchWrite(BatchWrite batch) { 378 public List<Operation> batchWrite(BatchWrite batch) {
381 // Hazelcast version will never fail for conditional failure now. 379 // Hazelcast version will never fail for conditional failure now.
...@@ -384,6 +382,18 @@ public class HazelcastIntentStore ...@@ -384,6 +382,18 @@ public class HazelcastIntentStore
384 List<Pair<Operation, List<Future<?>>>> futures = new ArrayList<>(batch.operations().size()); 382 List<Pair<Operation, List<Future<?>>>> futures = new ArrayList<>(batch.operations().size());
385 List<IntentEvent> events = Lists.newArrayList(); 383 List<IntentEvent> events = Lists.newArrayList();
386 384
385 + batchWriteAsync(batch, failed, futures);
386 +
387 + // verify result
388 + verifyAsyncWrites(futures, failed, events);
389 +
390 + notifyDelegate(events);
391 +
392 + return failed;
393 + }
394 +
395 + private void batchWriteAsync(BatchWrite batch, List<Operation> failed,
396 + List<Pair<Operation, List<Future<?>>>> futures) {
387 for (Operation op : batch.operations()) { 397 for (Operation op : batch.operations()) {
388 switch (op.type()) { 398 switch (op.type()) {
389 case CREATE_INTENT: 399 case CREATE_INTENT:
...@@ -437,8 +447,18 @@ public class HazelcastIntentStore ...@@ -437,8 +447,18 @@ public class HazelcastIntentStore
437 break; 447 break;
438 } 448 }
439 } 449 }
450 + }
440 451
441 - // verify result 452 + /**
453 + * Checks the async write result Futures and prepare Events to post.
454 + *
455 + * @param futures async write Futures
456 + * @param failed list to output failed batch write operations
457 + * @param events list to output events to post as result of writes
458 + */
459 + private void verifyAsyncWrites(List<Pair<Operation, List<Future<?>>>> futures,
460 + List<Operation> failed,
461 + List<IntentEvent> events) {
442 for (Pair<Operation, List<Future<?>>> future : futures) { 462 for (Pair<Operation, List<Future<?>>> future : futures) {
443 final Operation op = future.getLeft(); 463 final Operation op = future.getLeft();
444 final List<Future<?>> subops = future.getRight(); 464 final List<Future<?>> subops = future.getRight();
...@@ -582,10 +602,6 @@ public class HazelcastIntentStore ...@@ -582,10 +602,6 @@ public class HazelcastIntentStore
582 break; 602 break;
583 } 603 }
584 } 604 }
585 -
586 - notifyDelegate(events);
587 -
588 - return failed;
589 } 605 }
590 606
591 public final class RemoteIntentStateListener extends EntryAdapter<IntentId, IntentState> { 607 public final class RemoteIntentStateListener extends EntryAdapter<IntentId, IntentState> {
......