-
Notifications
You must be signed in to change notification settings - Fork 29
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
Prepare for java 8,11 3.0.0 #190
Conversation
will look like with java 17 FFM Panama
This is ready for review with a target version of DS-memory 3.0.0. There are quite a few changes -- all with the intent of moving to a java 8,11 API that resembles what the API will be in Java 17. It is not perfect, but a lot closer that what it was. I need to release this before I can release DS-java 6.1.0 which will still be java 8,11, and depend on this. |
Improved the toString methods. Simplified BaseBuffer API.
And BaseBufferImpl to PositionalImpl. Cleaned up some duplicate methods. Improved some javadocs.
Corrected some tests that were referring to the wrong exception.
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.
There are a few very, very minor things.
We should try to move all the <i>
stuff to <code>
but that's not a priority for this PR.
datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java
Show resolved
Hide resolved
* @param currentWritableMemory the current writableMemory of the client. It must be non-null. | ||
* @param capacityBytes The capacity being requested. It must be ≥ 0. | ||
* @param newCapacityBytes The capacity being requested. It must be > the capacity of the currentWritableMemory. |
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.
Why does it need to be larger?
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.
This is the MemoryRequestServer and the intent is to request a larger memory. It doesn't make sense to request a memory space smaller than what you already have.
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.
So we don't support the pattern of getting a smaller amount of additional memory while keeping the current memory?
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.
Not with this interface, and never have. If you want a separate smaller memory, use the regular allocate methods for that. This is explicitly for the case where a sketch runs out of its allocated memory
datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Memory.java
Show resolved
Hide resolved
* {@link #map(File, long, long, ByteOrder) map(file, 0, file.length(), ByteOrder.nativeOrder())}. | ||
* @param file the given file to map. It must be non-null, length ≥ 0, and readable. | ||
* {@link #map(File, long, long, ByteOrder) | ||
* map(file, 0, file.length(), scope, ByteOrder.nativeOrder())}. |
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.
link has 4 parameters, example has 5. Make sure it points to the right place.
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.
Yep. this is a javadoc comment bug and it occurred in 3 places. Will fix. I also searched the entire ds-memory repo for this bug and it is clean.
* @param capacityBytes the size of the mapped memory. It must not be negative. | ||
* @param byteOrder the byte order to be used for the mapped memory. It must be non-null. | ||
* @param file the given file to map. It must be non-null, readable and length ≥ 0. | ||
* @param fileOffsetBytes the position in the given file in bytes. It must ≥ 0. |
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.
must be ≥ 0
currently missing the word "be"
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.
will Fix.
* @param capacityBytes the size of the desired memory in bytes. It must be ≥ 0. | ||
* @return WritableMemory for this off-heap resource. | ||
* @param capacityBytes the size of the desired memory in bytes. | ||
* @return WritableMemory for this off-heap, native resource. |
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.
I think it's worth specifying "byte order" explicitly so it's clear what "native" refers to.
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.
In this specific context I meant native=off-heap, but it is equally valid to mean native byte-order! This double use of "native" bugs me. But the double use also exists in Panama. I'm not sure what to do about this. I could go through the entire repo and check for all uses of "native" and make sure the context is clear.
sb.append("MemReq, hashCode : ").append(memReqStr).append(LS); | ||
sb.append("Valid : ").append(state.isValid()).append(LS); | ||
sb.append("MemReqSvr, hashCode : ").append(memReqStr).append(LS); | ||
sb.append("Valid : ").append(state.isAlive()).append(LS); |
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.
Should the text be changed to Alive
to reflect the method name?
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.
Yes, and I will check the whole repo for this substitution.
@@ -96,15 +96,15 @@ public void checkArrayWrap() { | |||
assertEquals(v, i); | |||
} | |||
// check 0 length array wraps | |||
Memory memZeroLengthArrayBoolean = WritableMemory.writableWrap(new boolean[0]); | |||
//Memory memZeroLengthArrayBoolean = WritableMemory.writableWrap(new boolean[0]); |
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.
should just remove these entirely instead of commenting them out
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.
Will remove.
/** | ||
* Example of how to use the MemoryRequestServer with a memory hungry client. | ||
* | ||
* <p>Note: this example only works with Java 17.</p> |
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.
Is this accurate? If so, is it excluded from running?
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.
Not accurate. Removed. It works fine in Java8
1. I have corrected the javadocs and code comments to use "off-heap" instead of "direct" or "native". However, I decided not to change the use of "Direct" in existing method calls or in the /internal/ directory. That would cause a huge number of changes (100's). 2. I have corrected the javadocs and code comments to use "alive" or "isAlive" instead of "valid" or "isValid". However, I decided not to change the word "Valid" in the /internal/ directory. That would cause a huge number of changes (100's).
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.
Thankfully a single commit so I was able to look at that diff rather than try to figure out what changed in the entire PR :)
Prepares the java 8,11 code-base for a 3.0.0 release.