Committed by
Sho Shimizu
Revert "Use Optional instead of null to remove FIXME comment"
This reverts commit 9639df7b. This is due to the regression described in ONOS-825. Change-Id: I2909ed3e3461439596f99bf0cd94da3792a0ff64
Showing
2 changed files
with
8 additions
and
10 deletions
| ... | @@ -17,25 +17,23 @@ package org.onosproject.net.flow; | ... | @@ -17,25 +17,23 @@ package org.onosproject.net.flow; |
| 17 | 17 | ||
| 18 | import org.onosproject.net.flow.FlowRuleBatchEntry.FlowRuleOperation; | 18 | import org.onosproject.net.flow.FlowRuleBatchEntry.FlowRuleOperation; |
| 19 | 19 | ||
| 20 | -import java.util.Optional; | ||
| 21 | - | ||
| 22 | 20 | ||
| 23 | public class FlowRuleBatchEntry | 21 | public class FlowRuleBatchEntry |
| 24 | extends BatchOperationEntry<FlowRuleOperation, FlowRule> { | 22 | extends BatchOperationEntry<FlowRuleOperation, FlowRule> { |
| 25 | 23 | ||
| 26 | - private final Optional<Long> id; | 24 | + private final Long id; // FIXME: consider using Optional<Long> |
| 27 | 25 | ||
| 28 | public FlowRuleBatchEntry(FlowRuleOperation operator, FlowRule target) { | 26 | public FlowRuleBatchEntry(FlowRuleOperation operator, FlowRule target) { |
| 29 | super(operator, target); | 27 | super(operator, target); |
| 30 | - this.id = Optional.empty(); | 28 | + this.id = null; |
| 31 | } | 29 | } |
| 32 | 30 | ||
| 33 | - public FlowRuleBatchEntry(FlowRuleOperation operator, FlowRule target, long id) { | 31 | + public FlowRuleBatchEntry(FlowRuleOperation operator, FlowRule target, Long id) { |
| 34 | super(operator, target); | 32 | super(operator, target); |
| 35 | - this.id = Optional.of(id); | 33 | + this.id = id; |
| 36 | } | 34 | } |
| 37 | 35 | ||
| 38 | - public Optional<Long> id() { | 36 | + public Long id() { |
| 39 | return id; | 37 | return id; |
| 40 | } | 38 | } |
| 41 | 39 | ... | ... |
| ... | @@ -385,7 +385,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr | ... | @@ -385,7 +385,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr |
| 385 | 385 | ||
| 386 | private final Set<FlowEntry> offendingFlowMods = Sets.newHashSet(); | 386 | private final Set<FlowEntry> offendingFlowMods = Sets.newHashSet(); |
| 387 | // Failed batch operation id | 387 | // Failed batch operation id |
| 388 | - private Optional<Long> failedId; | 388 | + private Long failedId; |
| 389 | 389 | ||
| 390 | private final CountDownLatch countDownLatch; | 390 | private final CountDownLatch countDownLatch; |
| 391 | private BatchState state; | 391 | private BatchState state; |
| ... | @@ -509,7 +509,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr | ... | @@ -509,7 +509,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr |
| 509 | public CompletedBatchOperation get() throws InterruptedException, ExecutionException { | 509 | public CompletedBatchOperation get() throws InterruptedException, ExecutionException { |
| 510 | countDownLatch.await(); | 510 | countDownLatch.await(); |
| 511 | this.state = BatchState.FINISHED; | 511 | this.state = BatchState.FINISHED; |
| 512 | - Set<Long> failedIds = (failedId.isPresent()) ? Sets.newHashSet(failedId.get()) : Collections.emptySet(); | 512 | + Set<Long> failedIds = (failedId != null) ? Sets.newHashSet(failedId) : Collections.emptySet(); |
| 513 | CompletedBatchOperation result = | 513 | CompletedBatchOperation result = |
| 514 | new CompletedBatchOperation(ok.get(), offendingFlowMods, failedIds); | 514 | new CompletedBatchOperation(ok.get(), offendingFlowMods, failedIds); |
| 515 | //FIXME do cleanup here (moved by BOC) | 515 | //FIXME do cleanup here (moved by BOC) |
| ... | @@ -523,7 +523,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr | ... | @@ -523,7 +523,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr |
| 523 | TimeoutException { | 523 | TimeoutException { |
| 524 | if (countDownLatch.await(timeout, unit)) { | 524 | if (countDownLatch.await(timeout, unit)) { |
| 525 | this.state = BatchState.FINISHED; | 525 | this.state = BatchState.FINISHED; |
| 526 | - Set<Long> failedIds = (failedId.isPresent()) ? Sets.newHashSet(failedId.get()) : Collections.emptySet(); | 526 | + Set<Long> failedIds = (failedId != null) ? Sets.newHashSet(failedId) : Collections.emptySet(); |
| 527 | CompletedBatchOperation result = | 527 | CompletedBatchOperation result = |
| 528 | new CompletedBatchOperation(ok.get(), offendingFlowMods, failedIds); | 528 | new CompletedBatchOperation(ok.get(), offendingFlowMods, failedIds); |
| 529 | // FIXME do cleanup here (moved by BOC) | 529 | // FIXME do cleanup here (moved by BOC) | ... | ... |
-
Please register or login to post a comment