use of com.google.errorprone.annotations.CanIgnoreReturnValue in project guava by google.
the class ConfigurableMutableNetwork method removeNode.
@Override
@CanIgnoreReturnValue
public boolean removeNode(Object node) {
checkNotNull(node, "node");
NetworkConnections<N, E> connections = nodeConnections.get(node);
if (connections == null) {
return false;
}
// Thus we avoid modifying the underlying view while iterating over it.
for (E edge : ImmutableList.copyOf(connections.incidentEdges())) {
removeEdge(edge);
}
nodeConnections.remove(node);
return true;
}
use of com.google.errorprone.annotations.CanIgnoreReturnValue in project guava by google.
the class ServiceManager method startAsync.
/**
* Initiates service {@linkplain Service#startAsync startup} on all the services being managed. It
* is only valid to call this method if all of the services are {@linkplain State#NEW new}.
*
* @return this
* @throws IllegalStateException if any of the Services are not {@link State#NEW new} when the
* method is called.
*/
@CanIgnoreReturnValue
public ServiceManager startAsync() {
for (Service service : services) {
State state = service.state();
checkState(state == NEW, "Service %s is %s, cannot start it.", service, state);
}
for (Service service : services) {
try {
state.tryStartTiming(service);
service.startAsync();
} catch (IllegalStateException e) {
// This can happen if the service has already been started or stopped (e.g. by another
// service or listener). Our contract says it is safe to call this method if
// all services were NEW when it was called, and this has already been verified above, so we
// don't propagate the exception.
logger.log(Level.WARNING, "Unable to start Service " + service, e);
}
}
return this;
}
use of com.google.errorprone.annotations.CanIgnoreReturnValue in project grpc-java by grpc.
the class NettyHandlerTestBase method enqueue.
@CanIgnoreReturnValue
protected final ChannelFuture enqueue(WriteQueue.QueuedCommand command) {
ChannelFuture future = writeQueue.enqueue(command, newPromise(), true);
channel.runPendingTasks();
return future;
}
use of com.google.errorprone.annotations.CanIgnoreReturnValue in project core-java by SpineEventEngine.
the class StandShould method doCheckReadingCustomersById.
@CanIgnoreReturnValue
Stand doCheckReadingCustomersById(int numberOfCustomers) {
// Define the types and values used as a test data.
final TypeUrl customerType = TypeUrl.of(Customer.class);
final Map<CustomerId, Customer> sampleCustomers = fillSampleCustomers(numberOfCustomers);
// Prepare the stand and its storage to act.
final StandStorage standStorage = setupStandStorageWithCustomers(sampleCustomers, customerType);
final Stand stand = prepareStandWithAggregateRepo(standStorage);
triggerMultipleUpdates(sampleCustomers, stand);
final Query readMultipleCustomers = requestFactory.query().byIds(Customer.class, sampleCustomers.keySet());
final MemoizeQueryResponseObserver responseObserver = new MemoizeQueryResponseObserver();
stand.execute(readMultipleCustomers, responseObserver);
final List<Any> messageList = checkAndGetMessageList(responseObserver);
assertEquals(sampleCustomers.size(), messageList.size());
final Collection<Customer> allCustomers = sampleCustomers.values();
for (Any singleRecord : messageList) {
final Customer unpackedSingleResult = AnyPacker.unpack(singleRecord);
assertTrue(allCustomers.contains(unpackedSingleResult));
}
return stand;
}
use of com.google.errorprone.annotations.CanIgnoreReturnValue in project core-java by SpineEventEngine.
the class StandShould method subscribeAndActivate.
@CanIgnoreReturnValue
protected static Subscription subscribeAndActivate(Stand stand, Topic topic, Stand.EntityUpdateCallback callback) {
final MemoizingObserver<Subscription> observer = memoizingObserver();
stand.subscribe(topic, observer);
final Subscription subscription = observer.firstResponse();
stand.activate(subscription, callback, StreamObservers.<Response>noOpObserver());
assertNotNull(subscription);
return subscription;
}
Aggregations