Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public void testFutureBash() {
final ExecutorService executor = Executors.newFixedThreadPool(barrier.getParties());
final AtomicReference<AbstractFuture<String>> currentFuture = Atomics.newReference();
final AtomicInteger numSuccessfulSetCalls = new AtomicInteger();
Callable<Void> completeSucessFullyRunnable =
Callable<Void> completeSuccessFullyRunnable =
new Callable<Void>() {
@Override
public Void call() {
Expand Down Expand Up @@ -430,7 +430,7 @@ public Void call() {
return null;
}
};
Callable<Void> setFutureCompleteSucessFullyRunnable =
Callable<Void> setFutureCompleteSuccessFullyRunnable =
new Callable<Void>() {
ListenableFuture<String> future = Futures.immediateFuture("setFuture");

Expand Down Expand Up @@ -511,10 +511,10 @@ public void run() {
}
};
List<Callable<?>> allTasks = new ArrayList<>();
allTasks.add(completeSucessFullyRunnable);
allTasks.add(completeSuccessFullyRunnable);
allTasks.add(completeExceptionallyRunnable);
allTasks.add(cancelRunnable);
allTasks.add(setFutureCompleteSucessFullyRunnable);
allTasks.add(setFutureCompleteSuccessFullyRunnable);
allTasks.add(setFutureCompleteExceptionallyRunnable);
allTasks.add(setFutureCancelRunnable);
for (int k = 0; k < 50; k++) {
Expand Down Expand Up @@ -577,24 +577,24 @@ public void testSetFutureCancelBash() {
final ExecutorService executor = Executors.newFixedThreadPool(barrier.getParties());
final AtomicReference<AbstractFuture<String>> currentFuture = Atomics.newReference();
final AtomicReference<AbstractFuture<String>> setFutureFuture = Atomics.newReference();
final AtomicBoolean setFutureSetSucess = new AtomicBoolean();
final AtomicBoolean setFutureCompletionSucess = new AtomicBoolean();
final AtomicBoolean cancellationSucess = new AtomicBoolean();
final AtomicBoolean setFutureSetSuccess = new AtomicBoolean();
final AtomicBoolean setFutureCompletionSuccess = new AtomicBoolean();
final AtomicBoolean cancellationSuccess = new AtomicBoolean();
Runnable cancelRunnable =
new Runnable() {
@Override
public void run() {
cancellationSucess.set(currentFuture.get().cancel(true));
cancellationSuccess.set(currentFuture.get().cancel(true));
awaitUnchecked(barrier);
}
};
Runnable setFutureCompleteSucessFullyRunnable =
Runnable setFutureCompleteSuccessFullyRunnable =
new Runnable() {
@Override
public void run() {
AbstractFuture<String> future = setFutureFuture.get();
setFutureSetSucess.set(currentFuture.get().setFuture(future));
setFutureCompletionSucess.set(future.set("hello-async-world"));
setFutureSetSuccess.set(currentFuture.get().setFuture(future));
setFutureCompletionSuccess.set(future.set("hello-async-world"));
awaitUnchecked(barrier);
}
};
Expand Down Expand Up @@ -640,7 +640,7 @@ public void run() {
};
List<Runnable> allTasks = new ArrayList<>();
allTasks.add(cancelRunnable);
allTasks.add(setFutureCompleteSucessFullyRunnable);
allTasks.add(setFutureCompleteSuccessFullyRunnable);
for (int k = 0; k < size; k++) {
// For each listener we add a task that submits it to the executor directly for the blocking
// get usecase and another task that adds it as a listener to the future to exercise both
Expand Down Expand Up @@ -673,27 +673,27 @@ public void run() {
Object result = Iterables.getOnlyElement(finalResults);
if (result == CancellationException.class) {
assertTrue(future.isCancelled());
assertTrue(cancellationSucess.get());
assertTrue(cancellationSuccess.get());
// cancellation can interleave in 3 ways
// 1. prior to setFuture
// 2. after setFuture before set() on the future assigned
// 3. after setFuture and set() are called but before the listener completes.
if (!setFutureSetSucess.get() || !setFutureCompletionSucess.get()) {
if (!setFutureSetSuccess.get() || !setFutureCompletionSuccess.get()) {
// If setFuture fails or set on the future fails then it must be because that future was
// cancelled
assertTrue(setFuture.isCancelled());
assertTrue(setFuture.wasInterrupted()); // we only call cancel(true)
}
} else {
// set on the future completed
assertFalse(cancellationSucess.get());
assertTrue(setFutureSetSucess.get());
assertTrue(setFutureCompletionSucess.get());
assertFalse(cancellationSuccess.get());
assertTrue(setFutureSetSuccess.get());
assertTrue(setFutureCompletionSuccess.get());
}
// reset for next iteration
setFutureSetSucess.set(false);
setFutureCompletionSucess.set(false);
cancellationSucess.set(false);
setFutureSetSuccess.set(false);
setFutureCompletionSuccess.set(false);
cancellationSuccess.set(false);
finalResults.clear();
}
executor.shutdown();
Expand All @@ -710,17 +710,17 @@ public void testSetFutureCancelBash_withDoneFuture() {
final ExecutorService executor = Executors.newFixedThreadPool(barrier.getParties());
final AtomicReference<AbstractFuture<String>> currentFuture = Atomics.newReference();
final AtomicBoolean setFutureSuccess = new AtomicBoolean();
final AtomicBoolean cancellationSucess = new AtomicBoolean();
final AtomicBoolean cancellationSuccess = new AtomicBoolean();
Callable<Void> cancelRunnable =
new Callable<Void>() {
@Override
public Void call() {
cancellationSucess.set(currentFuture.get().cancel(true));
cancellationSuccess.set(currentFuture.get().cancel(true));
awaitUnchecked(barrier);
return null;
}
};
Callable<Void> setFutureCompleteSucessFullyRunnable =
Callable<Void> setFutureCompleteSuccessFullyRunnable =
new Callable<Void>() {
final ListenableFuture<String> future = Futures.immediateFuture("hello");

Expand Down Expand Up @@ -750,7 +750,7 @@ public void run() {
};
List<Callable<?>> allTasks = new ArrayList<>();
allTasks.add(cancelRunnable);
allTasks.add(setFutureCompleteSucessFullyRunnable);
allTasks.add(setFutureCompleteSuccessFullyRunnable);
allTasks.add(Executors.callable(collectResultsRunnable));
assertEquals(allTasks.size() + 1, barrier.getParties()); // sanity check
for (int i = 0; i < 1000; i++) {
Expand All @@ -768,15 +768,15 @@ public void run() {
Object result = Iterables.getOnlyElement(finalResults);
if (result == CancellationException.class) {
assertTrue(future.isCancelled());
assertTrue(cancellationSucess.get());
assertTrue(cancellationSuccess.get());
assertFalse(setFutureSuccess.get());
} else {
assertTrue(setFutureSuccess.get());
assertFalse(cancellationSucess.get());
assertFalse(cancellationSuccess.get());
}
// reset for next iteration
setFutureSuccess.set(false);
cancellationSucess.set(false);
cancellationSuccess.set(false);
finalResults.clear();
}
executor.shutdown();
Expand Down
2 changes: 1 addition & 1 deletion guava/src/com/google/common/collect/ArrayTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private ArrayTable(Iterable<? extends R> rowKeys, Iterable<? extends C> columnKe
* TODO(jlevy): Support only one of rowKey / columnKey being empty? If we
* do, when columnKeys is empty but rowKeys isn't, rowKeyList() can contain
* elements but rowKeySet() will be empty and containsRow() won't
* acknolwedge them.
* acknowledge them.
*/
rowKeyToIndex = Maps.indexMap(rowList);
columnKeyToIndex = Maps.indexMap(columnList);
Expand Down
4 changes: 2 additions & 2 deletions guava/src/com/google/common/io/BaseEncoding.java
Original file line number Diff line number Diff line change
Expand Up @@ -1052,12 +1052,12 @@ public Appendable append(@Nullable CharSequence chars) throws IOException {
@GwtIncompatible // Writer
static Writer separatingWriter(
final Writer delegate, final String separator, final int afterEveryChars) {
final Appendable seperatingAppendable =
final Appendable separatingAppendable =
separatingAppendable(delegate, separator, afterEveryChars);
return new Writer() {
@Override
public void write(int c) throws IOException {
seperatingAppendable.append((char) c);
separatingAppendable.append((char) c);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion guava/src/com/google/common/io/ByteStreams.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public static long copy(ReadableByteChannel from, WritableByteChannel to) throws
*/
private static byte[] toByteArrayInternal(InputStream in, Queue<byte[]> bufs, int totalLen)
throws IOException {
// Starting with an 8k buffer, double the size of each sucessive buffer. Buffers are retained
// Starting with an 8k buffer, double the size of each successive buffer. Buffers are retained
// in a deque so that there's no copying between buffers while reading and so all of the bytes
// in each new allocated buffer are available for reading from the stream.
for (int bufSize = BUFFER_SIZE;
Expand Down