Skip to content

Should AsyncHttpClient implement AutoCloseable / Closeable? #44

Closed
@bclozel

Description

@bclozel

Looking into try with resources, I've been wondering.

Should AsyncHttpClient implement AutoCloseable?

AutoCloseable interface only comes with java 1.7+, so that would break backwards compatibility for a small feature...

Should AsyncHttpClient implement Closeable?

Closeable is a subinterface of AutoCloseable and comes with java 1.5+, so compatibility should not be an issue. But this interface says:

void close() throws IOException

So we're breaking here the existing API (the current API doesn't throw any exception on close()).

  • People should subclass AsyncHttpClient and implement one of these if they feel the need to?
  • The "try with resource" statement doesn't play nicely with async?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions