-
Notifications
You must be signed in to change notification settings - Fork 18
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
"fast-start" the delivery of gzip-compressed bodies, and support flushing of GZIPOutputStreams on JDK7+ #3
Conversation
…hing of GZIPOutputStreams on JDK7+ GZIPOutputStream.flush() is essentially a no-op under <= JDK6 given http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4813885. We weren't calling it before anyway, but its JDK7 semantics are necessary when compressing seq response bodies; otherwise, the middleware will require complete consumption of the seq before a single byte hits the wire. Without this change, gzipping of seq bodies that are truly lazy (e.g. supporting server-sent events) is not practical; this patch therefore also disables seq body support given pre-JDK7 GZIPOutputStream.flush() functionality.
(->> (clojure.reflect/reflect GZIPOutputStream) | ||
:members | ||
(some (comp '#{[java.io.OutputStream boolean]} :parameter-types)))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does defining this check at compile-time still work if this library ever gets AOTed? I remember some issues in clojure.core.reducers trying to auto-detect JDK7 in a similar way, and all it did was auto-detect what was present on the build machine. I'd be more comfortable defining this as a delay
and then forcing it when needed, so it always runs on the client machine.
Good points on both counts. I didn't even think of AOT. I'll update the PR shortly. |
Unless I'm having a dull moment, if the constructor choice is put into a macro, then AOT will again fix the choice to whatever suits the build environment, not the runtime environment. Does it really matter if a bum, unused ctor form is compiled under <=JDK6? |
Yeah, I think you're right: it's not possible to fix both of my On 09/12/2013 05:26 PM, Chas Emerick wrote:
|
Well, as-is doesn't make much sense, as then neither problem is addressed. I personally think the AOT problem is more significant; that could actively prevent some people from using the library if they have a peculiar build/deployment setup. The ctor thing is just a dead code path, fundamentally benign. I'll fix whichever one you like. it's your library. :-) |
Yeah, you're right. Leave the dead code, but fix the AOT problem by On 09/13/2013 12:11 PM, Chas Emerick wrote:
|
Bumping before I forget… :-) |
Huh. Github didn't email me when you added that commit. I'll merge and release a new version in a sec. |
"fast-start" the delivery of gzip-compressed bodies, and support flushing of GZIPOutputStreams on JDK7+
GZIPOutputStream.flush() is essentially a no-op under <= JDK6 given
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4813885. We weren't
calling it before anyway, but its JDK7 semantics are necessary when
compressing seq response bodies; otherwise, the middleware will require
complete consumption of the seq before a single byte hits the wire.
Without this change, gzipping of seq bodies that are truly lazy (e.g.
supporting server-sent events) is not practical; this patch therefore
also disables seq body support given pre-JDK7 GZIPOutputStream.flush()
functionality.