Skip to content

Commit a712677

Browse files
committed
rename the callback to something not such a mouthful.
1 parent ee1ceb9 commit a712677

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

AndroidAsync/src/com/koushikdutta/async/future/Future.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33

44
public interface Future<T> extends Cancellable, java.util.concurrent.Future<T> {
5-
public FutureCallback<T> getResultCallback();
6-
public Future<T> setResultCallback(FutureCallback<T> callback);
5+
public FutureCallback<T> getCallback();
6+
public Future<T> setCallback(FutureCallback<T> callback);
77
}

AndroidAsync/src/com/koushikdutta/async/future/SimpleFuture.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ public boolean setComplete(T value) {
109109

110110
FutureCallback<T> callback;
111111
@Override
112-
public FutureCallback<T> getResultCallback() {
112+
public FutureCallback<T> getCallback() {
113113
return callback;
114114
}
115115

116116
@Override
117-
public Future<T> setResultCallback(FutureCallback<T> callback) {
117+
public Future<T> setCallback(FutureCallback<T> callback) {
118118
// callback can only be changed or read/used inside a sync block
119119
boolean runCallback;
120120
synchronized (this) {

AndroidAsyncTest/src/com/koushikdutta/async/test/FutureTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void testFutureCallback() throws Exception {
4141
final Semaphore semaphore = new Semaphore(0);
4242
final IntegerFuture future = IntegerFuture.create(20, 1000);
4343
final Thread mainThread = Thread.currentThread();
44-
future.setResultCallback(new FutureCallback<Integer>() {
44+
future.setCallback(new FutureCallback<Integer>() {
4545
@Override
4646
public void onCompleted(Exception e, Integer result) {
4747
assertNotSame(Thread.currentThread(), mainThread);
@@ -57,7 +57,7 @@ public void testFutureFinishedCallback() throws Exception {
5757
final IntegerFuture future = IntegerFuture.create(20, 1);
5858
Thread.sleep(1000);
5959
final Thread mainThread = Thread.currentThread();
60-
future.setResultCallback(new FutureCallback<Integer>() {
60+
future.setCallback(new FutureCallback<Integer>() {
6161
@Override
6262
public void onCompleted(Exception e, Integer result) {
6363
assertEquals(Thread.currentThread(), mainThread);

AndroidAsyncTest/src/com/koushikdutta/async/test/HttpClientTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void testInsecureGithubRandomDataWithFuture() throws Exception {
118118
public void testInsecureGithubRandomDataWithFutureCallback() throws Exception {
119119
final Semaphore semaphore = new Semaphore(0);
120120
final Md5 md5 = Md5.createInstance();
121-
client.getByteBufferList(githubInsecure).setResultCallback(new FutureCallback<ByteBufferList>() {
121+
client.getByteBufferList(githubInsecure).setCallback(new FutureCallback<ByteBufferList>() {
122122
@Override
123123
public void onCompleted(Exception e, ByteBufferList bb) {
124124
md5.update(bb);
@@ -137,7 +137,7 @@ public void testGithubHelloWithFuture() throws Exception {
137137
public void testGithubHelloWithFutureCallback() throws Exception {
138138
final Semaphore semaphore = new Semaphore(0);
139139
client.getString("https://" + githubPath + "hello.txt")
140-
.setResultCallback(new FutureCallback<String>() {
140+
.setCallback(new FutureCallback<String>() {
141141
@Override
142142
public void onCompleted(Exception e, String result) {
143143
assertEquals(result, "hello world");

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Futures can also have callbacks...
185185
186186
```java
187187
Future<String> string = client.getString("http://foo.com/hello.txt");
188-
string.setResultCallback(new FutureCallback<String>() {
188+
string.setCallback(new FutureCallback<String>() {
189189
@Override
190190
public void onCompleted(Exception e, String result) {
191191
System.out.println(result);
@@ -197,7 +197,7 @@ For brevity...
197197
198198
```java
199199
client.getString("http://foo.com/hello.txt")
200-
.setResultCallback(new FutureCallback<String>() {
200+
.setCallback(new FutureCallback<String>() {
201201
@Override
202202
public void onCompleted(Exception e, String result) {
203203
System.out.println(result);

0 commit comments

Comments
 (0)