问题
I wrote the most simple application that uses WebSockets. My back end is GlassFish 4 build 89, my front end is a JavaFX 2.2 application client that uses Tyrus 1.0 RC3, the reference implementation of Java API for WebSockets. GlassFish uses Tyrus too although I've been to lazy to lookup exactly what version is included in GlassFish build 89.
My test of the WebSocket API sent a java.util.Date
back and forth, nothing more. Well, as a binary object should be added. So I wrote my own Decoder
that implements Decoder.Binary<Date>. As usual when I enter new fields of knowledge, I like to log each method invocation. And when I looked in the console, it hit me that my Deocer.Binary<Date>#willDecode(ByteBuffer)
method was called twice in a row by the same thread! If that really is intentional, what would be the use case for such a pattern, what value was added? But I think it must be a bug! I tried to file a bug/issue over at some GlassFish JIRA site but I didn't find the button anywhere.
回答1:
not a bug in terms of specification violation (there is no restriction on "willDecode" invocation count), but I agree we should look into it.
progress can be tracked on Tyrus jira, see TYRUS-210.
Thanks!
来源:https://stackoverflow.com/questions/17131946/bug-in-glassfish-4-or-tyrus-decoderwilldecode-is-called-twice-for-each-bytebuf