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

AsyncResponse#setTimeOut always return false, and timeout is not set #2044

Closed
jerseyrobot opened this issue Mar 7, 2013 · 5 comments
Closed

Comments

@jerseyrobot
Copy link
Contributor

In ServerRuntime#setTimeout, an exception is thrown (unlike in 2.0-m11or12) and catched, returning false:

java.lang.IllegalStateException: Must not call AsyncContext.setTimeout after the container-initiated dispatch during which ServletRequest.startAsync was called has returned to the container

@Path("resource")
public class Resource {
  private static final ArrayBlockingQueue<AsyncResponse> queue = new ArrayBlockingQueue<>(1);
	@GET
	@Path("suspend")
	public void suspend(@Suspended AsyncResponse asyncResponse) {
		queue.add(asyncResponse);
	}

	@POST
	@Path("settimeout")
	public void setTimeOut(String milis) {
		AsyncResponse async = queue.take(0);
		async.setTimeout(Long.parseLong(milis), TimeUnit.MILLISECONDS); //FALSE!! 	}
}

The following calls are performed:

GET http://localhost:8080/web/resource/suspend
and
POST http://localhost:8080/jaxrs_platform_container_asyncresponse_web/resource/settimeout
Content-Type:text/plain,
200

Affected Versions

[2.0-m13]

@jerseyrobot
Copy link
Contributor Author

@glassfishrobot Commented
Reported by jan.supol

@jerseyrobot
Copy link
Contributor Author

@glassfishrobot Commented
Was assigned to michalgajdos

@jerseyrobot
Copy link
Contributor Author

@glassfishrobot Commented
Marked as fixed on Thursday, March 21st 2013, 2:34:50 pm

@jerseyrobot
Copy link
Contributor Author

@glassfishrobot Commented
This issue was imported from java.net JIRA JERSEY-1772

@jerseyrobot
Copy link
Contributor Author

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

No branches or pull requests

1 participant