Skip to content

Navigation Menu

Sign in
Sign up

Using arrow without open module in JPMS #1003

Unanswered
torito asked this question in Q&A
Discussion options

In the installation doc it is stated we should include some --add-opens to the JVM, however, in my scenario, is impossible to add those flags as I cannot control how the JVM is launched.

Currently, my application dont even start, because the MemoryUtil class is not loaded because an Exception in the static scope.

If instead of throwing an exception in the case the --add-opens is not set, we catch it as the other exceptions, we'll be able to load the class, and use arrow in our system

final Object maybeDirectBufferConstructor =
 AccessController.doPrivileged(
 new PrivilegedAction<Object>() {
 @Override
 public Object run() {
 try {
 final Constructor<?> constructor =
 (majorVersion >= 21)
 ? direct.getClass().getDeclaredConstructor(long.class, long.class)
 : direct.getClass().getDeclaredConstructor(long.class, int.class);
 constructor.setAccessible(true);
 logger.debug("Constructor for direct buffer found and made accessible");
 return constructor;
 } catch (NoSuchMethodException e) {
 logger.debug("Cannot get constructor for direct buffer allocation", e);
 return e;
 } catch (SecurityException e) {
 logger.debug("Cannot get constructor for direct buffer allocation", e);
 return e;
 } catch (InaccessibleObjectException e) { // <-- new added exception case 
 logger.debug("Cannot get constructor for direct buffer allocation", e);
 return e;
 }
 }
 });

Currently, I'm forced to fork arrow because of this limitation. The proposed change is something acceptable ? I can propose a PR for it, but I dont know the full implications in all Arrow, but in my scenario is enough to use it for my purpose, and I would like to continue to use it without maintaining a fork.

Thanks

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /