Sho SHIMIZU
Committed by Brian O'Connor

Delete unnecessary semicolon

Change-Id: I2eaa4d900342a665f6dc4731a298b30a9ec40696
......@@ -301,19 +301,10 @@ public class DemoInstaller implements DemoAPI {
* @throws InterruptedException if the thread go interupted
*/
private void trackIntents() throws InterruptedException {
int count = 0;
while (!latch.await(100, TimeUnit.NANOSECONDS)) {
if (intentBatchService.getPendingOperations().isEmpty()) {
latch.countDown();
}
count++;
if (count > ITERATIONMAX) {
log.warn("A batch is stuck processing. " +
"pending : {}",
intentBatchService.getPendingOperations());
shutdownAndAwaitTermination(installWorker);
}
}
//FIXME
// TODO generate keys for each set of intents to allow manager to throttle
// TODO may also look into the store to see how many operations are pending
//if everything is good proceed.
if (!installWorker.isShutdown()) {
installWorker.execute(this);
......
......@@ -15,19 +15,12 @@
*/
package org.onosproject.sdnip;
import static org.easymock.EasyMock.reportMatcher;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
import org.easymock.IArgumentMatcher;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.intent.IntentOperation;
import org.onosproject.net.intent.IntentOperations;
import org.onosproject.sdnip.IntentSynchronizer.IntentKey;
import static org.easymock.EasyMock.reportMatcher;
/**
* Helper class for testing operations submitted to the IntentService.
*/
......@@ -54,13 +47,15 @@ public final class TestIntentServiceHelper {
* Matcher method to set the expected intent operations to match against
* (ignoring the intent ID for each intent).
*
* @param intentOperations the expected Intent Operations
* param intentOperations the expected Intent Operations
* @return the submitted Intent Operations
*/
/*
static IntentOperations eqExceptId(IntentOperations intentOperations) {
reportMatcher(new IdAgnosticIntentOperationsMatcher(intentOperations));
return intentOperations;
}
*/
/*
* EasyMock matcher that matches {@link Intent} but
......@@ -120,22 +115,13 @@ public final class TestIntentServiceHelper {
* value properties of the provided intent match the expected values, but
* ignores the intent ID when testing equality.
*/
/*
private static final class IdAgnosticIntentOperationsMatcher implements
IArgumentMatcher {
private final IntentOperations intentOperations;
//private final IntentOperations intentOperations;
private String providedString;
/**
* Constructor taking the expected intent operations to match against.
*
* @param intentOperations the expected intent operations
*/
public IdAgnosticIntentOperationsMatcher(
IntentOperations intentOperations) {
this.intentOperations = intentOperations;
}
@Override
public void appendTo(StringBuffer strBuffer) {
strBuffer.append("IntentOperationsMatcher unable to match: "
......@@ -178,6 +164,7 @@ public final class TestIntentServiceHelper {
providedReplaceIntents);
}
/**
* Extracts the intents per operation type. Each intent is encapsulated
* in IntentKey so it can be compared by excluding the Intent ID.
......@@ -189,6 +176,7 @@ public final class TestIntentServiceHelper {
* @param replaceIntents the REPLACE intents
* @param updateIntents the UPDATE intents
*/
/*
private void extractIntents(IntentOperations intentOperations,
List<IntentKey> submitIntents,
List<IntentId> withdrawIntentIds,
......@@ -220,4 +208,5 @@ public final class TestIntentServiceHelper {
}
}
}
*/
}
......
......@@ -17,8 +17,6 @@ package org.onosproject.net.intent;
import org.onosproject.core.ApplicationId;
import java.util.Set;
/**
* Service for tracking and delegating batches of intent operations.
*/
......@@ -26,26 +24,6 @@ import java.util.Set;
public interface IntentBatchService {
/**
* Submits a batch of intent operations.
*
* @param operations batch of operations
*/
void addIntentOperations(IntentOperations operations);
/**
* Removes the specified batch of intent operations after completion.
*
* @param operations batch of operations
*/
void removeIntentOperations(IntentOperations operations);
/**
* Returns the set of intent batches that are pending.
* @return set of batches
*/
Set<IntentOperations> getPendingOperations();
/**
* Return true if this instance is the local leader for batch
* processing a given application id.
*
......
/*
* Copyright 2014 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.net.intent;
import java.util.List;
import java.util.Objects;
import com.google.common.collect.ImmutableList;
import org.onosproject.core.ApplicationId;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.net.intent.IntentOperation.Type.REPLACE;
import static org.onosproject.net.intent.IntentOperation.Type.SUBMIT;
import static org.onosproject.net.intent.IntentOperation.Type.UPDATE;
import static org.onosproject.net.intent.IntentOperation.Type.WITHDRAW;
/**
* Batch of intent submit/withdraw/replace operations.
*/
@Deprecated //DELETEME
public final class IntentOperations {
private final List<IntentOperation> operations;
private final ApplicationId appId;
/**
* Creates a batch of intent operations using the supplied list.
*
* @param operations list of intent operations
*/
private IntentOperations(List<IntentOperation> operations, ApplicationId appId) {
checkNotNull(operations);
checkNotNull(appId);
// TODO: consider check whether operations are not empty because empty batch is meaningless
// but it affects the existing code to add this checking
this.operations = operations;
this.appId = appId;
}
/**
* List of operations that need to be executed as a unit.
*
* @return list of intent operations
*/
public List<IntentOperation> operations() {
return operations;
}
public ApplicationId appId() {
return appId;
}
/**
* Returns a builder for intent operation batches.
*
* @return intent operations builder
* @param applicationId application id
*/
public static Builder builder(ApplicationId applicationId) {
return new Builder(applicationId);
}
@Override
public int hashCode() {
return Objects.hash(operations);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
final IntentOperations other = (IntentOperations) obj;
return Objects.equals(this.operations, other.operations);
}
@Override
public String toString() {
return toStringHelper(this)
.add("operations", operations)
.toString();
}
/**
* Builder for batches of intent operations.
*/
public static final class Builder {
private final ImmutableList.Builder<IntentOperation> builder = ImmutableList.builder();
private final ApplicationId appId;
// Public construction is forbidden.
private Builder(ApplicationId appId) {
this.appId = appId;
}
/**
* Adds an intent submit operation.
*
* @param intent intent to be submitted
* @return self
*/
public Builder addSubmitOperation(Intent intent) {
checkNotNull(intent, "Intent cannot be null");
builder.add(new IntentOperation(SUBMIT, intent));
return this;
}
/**
* Adds an intent submit operation.
*
* @param oldIntentId intent to be replaced
* @param newIntent replacement intent
* @return self
*/
public Builder addReplaceOperation(IntentId oldIntentId, Intent newIntent) {
checkNotNull(oldIntentId, "Intent ID cannot be null");
checkNotNull(newIntent, "Intent cannot be null");
builder.add(new IntentOperation(REPLACE, newIntent)); //FIXME
return this;
}
/**
* Adds an intent submit operation.
*
* @param intentId identifier of the intent to be withdrawn
* @return self
*/
public Builder addWithdrawOperation(IntentId intentId) {
checkNotNull(intentId, "Intent ID cannot be null");
builder.add(new IntentOperation(WITHDRAW, null)); //FIXME
return this;
}
/**
* Adds an intent update operation.
*
* @param intentId identifier of the intent to be updated
* @return self
*/
public Builder addUpdateOperation(IntentId intentId) {
checkNotNull(intentId, "Intent ID cannot be null");
builder.add(new IntentOperation(UPDATE, null)); //FIXME
return this;
}
/**
* Builds a batch of intent operations.
*
* @return immutable batch of intent operations
*/
public IntentOperations build() {
return new IntentOperations(builder.build(), appId);
}
}
}
......@@ -48,7 +48,7 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> {
@Deprecated
default Intent getIntent(IntentId intentId) {
throw new UnsupportedOperationException("deprecated");
};
}
/**
* Returns the state of the specified intent.
......