-
Notifications
You must be signed in to change notification settings - Fork 355
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
Allow access to V8Locker.thread and improve "invalid thread access" messages #228
Comments
A pull request that's currently pending a merge partially addresses this with the introduction of a ConcurrentV8 class (which you can see here). Maybe the ConcurrentV8 functionality could be amended by or merged with your suggestions, or even better it may meet your needs entirely. ;D |
Thanks for the reply. I had a quick look at the PR and saw that it is not only about threading but also about JAVA<->JS interop with classes ... which is exactly what I'm trying to do currently 😄 I also saw in the PR discussion that J2V8-classes was mentioned which is what I am currently using and fixing/extending as I go along. @irbull @mizumi @yofreke @drywolf For example I integrated some missing / incomplete functionality in J2V8-classes that should allow to instantiate classes via Java reflection that were extened in a JS script from a base java class/interface. Let me know what you guys are thinking, I would be happy to collaborate on this. |
Glad it helped you! Yeah, a lot of people have been trying to do similar things across the board. The only thing my PR doesn't address is extending Java classes in JS. However, it does support the implementation of Java functional interfaces (lambdas) with zero extra effort on either end of the API via the use of proxy classes. While this is definitely my own opinion showing through (and not in any way a fact), I'm of the belief that's it's better to avoid extending entire classes from Ecma-like script run times since it simplifies the architecture of the system, as well as avoids egregious hacks in the JS side. That said, I think it would be trivial to add the capability for entire class extension to meet everyone's needs. I'd be delighted to have a discussion about these features so we can get them incorporated directly into V8. |
Thanks everyone. I have added some of these to master. In particular:
We already have |
Hi,
I am trying to use J2V8 from within a server platform (SonarQube) which makes much use of multi-threading. Therefore it is quite a tricky thing to not violate the single threading access when interacting with J2V8.
To make it easier to reason about what is going on when using the V8Locker class to acquire and release access of a thread to a V8 runtime, I would propose:
Please let me know what you think of those, it would really help me out to get things working much more effortlessly and quickly for what I'm trying.
I would provide a pull request once you can confirm that my proposed additions are a good idea.
Regards
The text was updated successfully, but these errors were encountered: