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

Cannot put java number into java.util.concurrent.ConcurrentHashMap #2230

guai opened this issue Nov 24, 2014 · 2 comments

Cannot put java number into java.util.concurrent.ConcurrentHashMap #2230

guai opened this issue Nov 24, 2014 · 2 comments


Copy link

guai commented Nov 24, 2014

jruby 1.7.13

Into default jruby map I can put 1.to_java and get back Java::JavaLang::Long
But from ConcurrentHashMap I always got Fixnum
Tried java_send without success

Copy link

headius commented Nov 24, 2014

When passing values to and from Java types, we automatically coerce numbers and strings. That means numbers coming out of a ConcurrentHashMap will always get turned into Fixnum on the way out. This may not be desirable but it is somewhat "legacy" behavior now. Does this cause a problem for you?

Copy link

guai commented Nov 26, 2014

We used ruby native map with Fixnum to java Integer mapping for speeding up our jruby - java interop via avoiding conversions. And we did have speed up.
But then we switched to ConcurrentHashMap. And I have no idea how speed it up back.
We switched because native jruby maps hangs when used concurrently from different threads. I think I posted an issue about this, but cannot find this post now.
Problem only in that this speed up does not work anymore. Maybe we'll workaround somehow.

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

No branches or pull requests

3 participants