You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2025/05/10 23:01:40 UTC
(datasketches-memory) 03/03: changes (so far) for Java 24
This is an automated email from the ASF dual-hosted git repository.
leerho pushed a commit to branch main24
in repository https://gitbox.apache.org/repos/asf/datasketches-memory.git
commit 439dfb0480a535dc9c78af5061fb7ec11408724e
Author: Lee Rhodes <le...@gmail.com>
AuthorDate: Sat May 10 16:01:13 2025 -0700
changes (so far) for Java 24
---
.github/workflows/auto-jdk-matrix.yml | 14 +++++++-------
.github/workflows/auto-os-matrix.yml | 14 +++++++-------
pom.xml | 1 +
.../java/org/apache/datasketches/memory/Resource.java | 6 ++++--
.../datasketches/memory/internal/ResourceImpl.java | 19 ++++++++++---------
5 files changed, 29 insertions(+), 25 deletions(-)
diff --git a/.github/workflows/auto-jdk-matrix.yml b/.github/workflows/auto-jdk-matrix.yml
index 381222ac..2ea3efc7 100644
--- a/.github/workflows/auto-jdk-matrix.yml
+++ b/.github/workflows/auto-jdk-matrix.yml
@@ -1,13 +1,13 @@
name: Auto JDK Matrix Test & Install
on:
- push:
- paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.yaml', '**/*.yml', '**/LICENSE', '**/NOTICE' ]
- branches: [ 'main', '[0-9]+.[0-9]+.[Xx]' ]
- pull_request:
- paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.yaml', '**/*.yml', '**/LICENSE', '**/NOTICE' ]
- # The branches below must be a subset of the branches above
- branches: [ 'main', '[0-9]+.[0-9]+.[Xx]' ]
+# push:
+# paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.yaml', '**/*.yml', '**/LICENSE', '**/NOTICE' ]
+# branches: [ 'main', '[0-9]+.[0-9]+.[Xx]' ]
+# pull_request:
+# paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.yaml', '**/*.yml', '**/LICENSE', '**/NOTICE' ]
+# # The branches below must be a subset of the branches above
+# branches: [ 'main', '[0-9]+.[0-9]+.[Xx]' ]
workflow_dispatch:
env:
diff --git a/.github/workflows/auto-os-matrix.yml b/.github/workflows/auto-os-matrix.yml
index c267b559..31d01abf 100644
--- a/.github/workflows/auto-os-matrix.yml
+++ b/.github/workflows/auto-os-matrix.yml
@@ -1,13 +1,13 @@
name: Auto OS Matrix Test & Install
on:
- push:
- paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.yaml', '**/*.yml', '**/LICENSE', '**/NOTICE' ]
- branches: [ 'main', '[0-9]+.[0-9]+.[Xx]' ]
- pull_request:
- paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.yaml', '**/*.yml', '**/LICENSE', '**/NOTICE' ]
- # The branches below must be a subset of the branches above
- branches: [ 'main', '[0-9]+.[0-9]+.[Xx]' ]
+# push:
+# paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.yaml', '**/*.yml', '**/LICENSE', '**/NOTICE' ]
+# branches: [ 'main', '[0-9]+.[0-9]+.[Xx]' ]
+# pull_request:
+# paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.yaml', '**/*.yml', '**/LICENSE', '**/NOTICE' ]
+# # The branches below must be a subset of the branches above
+# branches: [ 'main', '[0-9]+.[0-9]+.[Xx]' ]
workflow_dispatch:
env:
diff --git a/pom.xml b/pom.xml
index 5ad03d70..e0d2d172 100644
--- a/pom.xml
+++ b/pom.xml
@@ -321,6 +321,7 @@ under the License.
<exclude>**/git.properties</exclude>
<exclude>LICENSE</exclude>
<exclude>NOTICE</exclude>
+ <exclude>**/*.code-workspace</exclude>
</excludes>
</configuration>
</plugin>
diff --git a/src/main/java/org/apache/datasketches/memory/Resource.java b/src/main/java/org/apache/datasketches/memory/Resource.java
index 7b68999a..6133110e 100644
--- a/src/main/java/org/apache/datasketches/memory/Resource.java
+++ b/src/main/java/org/apache/datasketches/memory/Resource.java
@@ -143,6 +143,7 @@ public interface Resource {
*/
void force();
+ //Temporary during transition
/**
* Returns the arena used to create this resource and possibly other resources.
* Be careful when you close the returned Arena, you may be closing other resources as well.
@@ -156,9 +157,10 @@ public interface Resource {
*/
long getCapacity();
+ //Temporary during transition
/**
- * Gets the MemorySegment that backs this resource as a read-only MemorySegment.
- * @return the MemorySegment that back this resource as a read-only MemorySegment.
+ * Gets the MemorySegment that backs this resource.
+ * @return the MemorySegment that back this resource.
*/
MemorySegment getMemorySegment();
diff --git a/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java b/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java
index ddcbeb6e..8c72060b 100644
--- a/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java
+++ b/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java
@@ -113,6 +113,7 @@ abstract class ResourceImpl implements Resource {
* Warning: This class is not thread-safe. Specifying an Arena that allows multiple threads is not recommended.
*/
ResourceImpl(final MemorySegment seg, final int typeId, final MemoryRequestServer memReqSvr, final Arena arena) {
+ Objects.requireNonNull(seg, "MemorySegment must not be null");
this.seg = seg;
this.typeId = typeId;
this.memReqSvr = memReqSvr;
@@ -305,8 +306,8 @@ abstract class ResourceImpl implements Resource {
final StringBuilder sb = new StringBuilder();
final int group1 = typeId & 0x7;
switch (group1) { // 0000 0XXX
- case 0 : sb.append(pad("Writable + ",32)); break;
- case 1 : sb.append(pad("ReadOnly + ",32)); break;
+ case 0 : sb.append(pad("Writable + ",32)); break; //from seg
+ case 1 : sb.append(pad("ReadOnly + ",32)); break; //from seg
case 2 : sb.append(pad("Writable + Region + ",32)); break;
case 3 : sb.append(pad("ReadOnly + Region + ",32)); break;
case 4 : sb.append(pad("Writable + Duplicate + ",32)); break;
@@ -317,10 +318,10 @@ abstract class ResourceImpl implements Resource {
}
final int group2 = (typeId >>> 3) & 0x3;
switch (group2) { // 000X X000 43
- case 0 : sb.append(pad("Heap + ",15)); break; // 00
- case 1 : sb.append(pad("Direct + ",15)); break; // 01
- case 2 : sb.append(pad("Map + Direct + ",15)); break; //10
- case 3 : sb.append(pad("Map + Direct + ",15)); break; //11
+ case 0 : sb.append(pad("Heap + ",15)); break; // 00 //from seg
+ case 1 : sb.append(pad("Direct + ",15)); break; // 01 //from seg
+ case 2 : sb.append(pad("Map + Direct + ",15)); break; //10 //from seg
+ case 3 : sb.append(pad("Map + Direct + ",15)); break; //11 //from seg
default: break;
}
final int group3 = (typeId >>> 5) & 0x1;
@@ -371,6 +372,7 @@ abstract class ResourceImpl implements Resource {
@Override
public void force() { seg.force(); }
+ //Temporary during transition
@Override
public Arena getArena() { return arena; }
@@ -379,10 +381,9 @@ abstract class ResourceImpl implements Resource {
return seg.byteSize();
}
+ //Temporary during transition
@Override
- public MemorySegment getMemorySegment() {
- return seg.asReadOnly();
- }
+ public MemorySegment getMemorySegment() { return seg; }
@Override
public final long getRelativeOffset(final Resource that) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org