Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Job into Call. CallTest = AsyncApiTest + SyncApiTest #764

Merged
merged 1 commit into from
Apr 25, 2014

Conversation

codefromthecrypt
Copy link

One call to rule them all.

  Call call = client.newCall(request); // cancelable
  call.execute(callback); // async
  // or (exclusive)
  response = call.execute(); // blocking

@codefromthecrypt
Copy link
Author

CallTest now has a lot of duplication.. we can either pick through it now, or later.

*/
public Response execute(Request request) throws IOException {
public Call newCall(Request request) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this much better.

@codefromthecrypt
Copy link
Author

cc @jhump

}

try {
call.execute(callback);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fail

@swankjesse
Copy link
Collaborator

LGTM

@codefromthecrypt
Copy link
Author

OK! updated to make blocking calls cancelable with tests. PTAL

codefromthecrypt pushed a commit that referenced this pull request Apr 25, 2014
Merge Job into Call. CallTest = AsyncApiTest + SyncApiTest
@codefromthecrypt codefromthecrypt merged commit 499f402 into master Apr 25, 2014
@codefromthecrypt codefromthecrypt deleted the adrian.callfusion branch April 25, 2014 20:01
}
});

Thread.sleep(100); // wait for it to go in flight.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid test flakiness (and potentially make this faster since often it won't even take 100 millis to do), I prefer to use latches to coordinate the main test thread and the async action.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can access a good spot to place such a latch. Here, we are looking at ensuring the http engine is initialized to avoid a quick exit. Without making a state loop on visibility of a protected field, I think a 100ms is next best, and as you mentioned, significantly long enough to avoid being flakey.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I was thinking it could be in the above submitted task, but I now see why that doesn't suffice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants