Skip to content

Commit

Permalink
Update minor checkstyle fixes, re-arrange a few method signatures.
Browse files Browse the repository at this point in the history
  • Loading branch information
leerho committed Nov 22, 2024
1 parent b874e6b commit 5147a45
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 17 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ jobs:
- name: Echo Java Version
run: java -version

- name: Print Current workflow
run: >
cat .github/workflows/javadoc.yml
- name: Generate JavaDoc
run: mvn javadoc:javadoc

- name: Deploy JavaDoc
uses: JamesIves/github-pages-deploy-action@5dc1d5a192aeb5ab5b7d5a77b7d36aea4a7f5c92
uses: JamesIves/[email protected]
# uses: JamesIves/github-pages-deploy-action@5dc1d5a192aeb5ab5b7d5a77b7d36aea4a7f5c92
with:
token: ${{ secrets.GITHUB_TOKEN }}
folder: target/reports/apidocs
Expand Down
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ under the License.
<useDefaultExcludes>true</useDefaultExcludes>
<excludes>
<!-- rat uses .gitignore for excludes by default -->
<!-- <exclude>**/nb-configuration.xml</exclude>-->
<exclude>**/*.yaml</exclude>
<exclude>**/*.yml</exclude>
<exclude>**/.*</exclude>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/datasketches/memory/Memory.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static Memory map(
long fileOffsetBytes,
long capacityBytes,
ByteOrder byteOrder) throws IOException {
return WritableMemoryImpl.wrapMap(arena, file, fileOffsetBytes, capacityBytes, true, byteOrder);
return WritableMemoryImpl.wrapMap(file, fileOffsetBytes, capacityBytes, byteOrder, true, arena);
}

//NO ALLOCATE DIRECT, makes no sense
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/apache/datasketches/memory/WritableMemory.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static WritableMemory writableWrap(
* required by the implementation.
*/
static WritableMemory writableMap(File file) throws IOException {
return writableMap(Arena.ofConfined(), file, 0, file.length(), ByteOrder.nativeOrder());
return writableMap(file, 0, file.length(), ByteOrder.nativeOrder(), Arena.ofConfined());
}

/**
Expand All @@ -103,29 +103,29 @@ static WritableMemory writableMap(
long fileOffsetBytes,
long capacityBytes,
ByteOrder byteOrder) throws IOException {
return WritableMemoryImpl.wrapMap(Arena.ofConfined(), file, fileOffsetBytes, capacityBytes, false, byteOrder);
return WritableMemoryImpl.wrapMap(file, fileOffsetBytes, capacityBytes, byteOrder, false, Arena.ofConfined());
}

/**
* Maps the specified portion of the given file into Memory for write operations.
* @param arena the given arena to map. It must be non-null.
* @param file the given file to map. It must be non-null and writable.
* @param fileOffsetBytes the position in the given file in bytes. It must not be negative.
* @param capacityBytes the size of the mapped Memory.
* @param byteOrder the given <i>ByteOrder</i>. It must be non-null.
* @param arena the given arena to map. It must be non-null.
* @return a file-mapped WritableMemory.
* @throws IllegalArgumentException if file is not readable or not writable.
* @throws IOException if the specified path does not point to an existing file, or if some other I/O error occurs.
* @throws SecurityException If a security manager is installed and it denies an unspecified permission
* required by the implementation.
*/
static WritableMemory writableMap(
Arena arena,
File file,
long fileOffsetBytes,
long capacityBytes,
ByteOrder byteOrder) throws IOException {
return WritableMemoryImpl.wrapMap(arena, file, fileOffsetBytes, capacityBytes, false, byteOrder);
ByteOrder byteOrder,
Arena arena) throws IOException {
return WritableMemoryImpl.wrapMap(file, fileOffsetBytes, capacityBytes, byteOrder, false, arena);
}

//ALLOCATE DIRECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,26 @@ public static WritableMemory wrapByteBuffer(
/**
* The implementation of <i>wrapMap</i> for <i>WritableMemory</i>.
* This method is also used for read-only operations when localReadOnly is false.
* @param arena the given arena. It must be non-null.
* @param file the given file to map. It must be non-null.
* @param fileOffsetBytes the file starting offset in bytes. It must be &ge; 0.
* @param capacityBytes the capacity of the mapped memory. It must be &ge; 0.
* It must be non-null.
* Typically use <i>Arena.ofConfined()</i>.
* Warning: specifying a <i>Arena.ofShared()</i> is not supported.
* @param localReadOnly true if read-only is being imposed locally, even if the given file is writable..
* @param byteOrder the given <i>ByteOrder</i>. It must be non-null.
* @param localReadOnly true if read-only is being imposed locally, even if the given file is writable..
* @param arena the given arena. It must be non-null.
* @return a <i>WritableMemory</i>
* @throws IllegalArgumentException if file is not readable.
* @throws IOException if mapping is not successful.
*/
public static WritableMemory wrapMap(
final Arena arena,
final File file,
final long fileOffsetBytes,
final long capacityBytes,
final ByteOrder byteOrder,
final boolean localReadOnly,
final ByteOrder byteOrder)
final Arena arena)
throws IllegalArgumentException, IOException {
Objects.requireNonNull(arena, "Arena must be non-null.");
Objects.requireNonNull(file, "File must be non-null.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void copyOffHeapToMemoryMappedFile()
WritableMemory dstMem = null;
WritableMemory srcMem = null;
try (Arena arena = Arena.ofConfined()) { //this scope manages two Memory objects
dstMem = WritableMemory.writableMap(arena, file, 0, numBytes, ByteOrder.nativeOrder());
dstMem = WritableMemory.writableMap(file, 0, numBytes, ByteOrder.nativeOrder(), arena);
srcMem = WritableMemory.allocateDirect(arena, numBytes, 8, ByteOrder.nativeOrder(), memReqSvr);

//load source with consecutive longs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ public void checkMapLeafs() throws IOException {
file.deleteOnExit(); //comment out if you want to examine the file.
// Off Heap, Native order, No ByteBuffer, No MemReqSvr
try (Arena arena = Arena.ofConfined()) {
WritableMemory memNO = WritableMemory.writableMap(arena, file, off, cap, NBO);
WritableMemory memNO = WritableMemory.writableMap(file, off, cap, NBO, arena);
memNO.putShort(0, (short) 1);
assertTrue(memNO.isDirect());
checkCombinations(memNO, off, cap, memNO.isDirect(), NBO, false, false);
}
// Off heap, Non Native order, No ByteBuffer, no MemReqSvr
try (Arena arena = Arena.ofConfined()) {
WritableMemory memNNO = WritableMemory.writableMap(arena, file, off, cap, NNBO);
WritableMemory memNNO = WritableMemory.writableMap(file, off, cap, NNBO, arena);
memNNO.putShort(0, (short) 1);
assertTrue(memNNO.isDirect());
checkCombinations(memNNO, off, cap, memNNO.isDirect(), NNBO, false, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void checkMapLeafs() throws IOException {

final long bytes = 128;
try (Arena arena = Arena.ofConfined()) {
WritableMemory mem = WritableMemory.writableMap(arena, file, 0L, bytes, ByteOrder.nativeOrder());
WritableMemory mem = WritableMemory.writableMap(file, 0L, bytes, ByteOrder.nativeOrder(), arena);
assertTrue(mem.isMapped());
assertFalse(mem.isReadOnly());
checkCrossLeafTypeIds(mem);
Expand Down

0 comments on commit 5147a45

Please sign in to comment.