Skip to content

Commit

Permalink
Merge pull request #234 from apache/minor_changes_in_wording
Browse files Browse the repository at this point in the history
Changes required to run on Windows + cleanup
  • Loading branch information
leerho authored Nov 8, 2024
2 parents dd5d421 + cb396aa commit 79fc105
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 284 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/.toolchains.xml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/auto-jdk-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: DataSketches-Memory Auto JDK Matrix Test & Install
on:
pull_request:
push:
branches: [ master ]
branches: [ main ]
workflow_dispatch:

env:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: DataSketches-Memory Manual OS Matrix Test & Install
name: DataSketches-Memory Auto OS Matrix Test & Install

on:
pull_request:
push:
branches: [ main ]
workflow_dispatch:

env:
MAVEN_OPTS: -Xmx4g -Xms1g
MAVEN_OPTS: -Xmx1g -Xms1g

jobs:
build:
Expand Down Expand Up @@ -34,26 +37,26 @@ jobs:

steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Cache local Maven repository
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: build-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: build-${{ runner.os }}-maven-

- name: Install Matrix JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.jdk }}
distribution: 'temurin'
java-package: jdk
architecture: x64
# Architecture options: x86, x64, armv7, aarch64, ppc64le
# setup-java@v3 has a "with cache" option
# setup-java@v4 has a "with cache" option

- name: Echo Java Version
run: >
Expand Down
71 changes: 0 additions & 71 deletions .github/workflows/manual-coverage.yml

This file was deleted.

86 changes: 0 additions & 86 deletions .github/workflows/manual-share-data.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The goal of this component of the DataSketches library is to provide a high perf

* On-heap Memory via primitive arrays
* On-heap Memory via ByteBuffers
* Off-heap (Direct) Memory via direct allocation
* Off-heap (Direct or Native) Memory via direct allocation
* Off-Heap Memory-Mapped files

Each of the four resource types is accessed using different API methods in the Memory component.
Expand Down Expand Up @@ -67,7 +67,7 @@ Note: *primitive* := *{byte, short, int, long, float, double}*
* *WritableMemory.writableMap(File)*

## Release 4.0.0 (inclusive) to 5.0.0 (exclusive)
Starting with release *datasketches-memory-4.0.0*, this Memory component supports Java 17 when compiling from source and should work with later Java versions at runtime. This component is not designed as a Java Module, so the Jar file should be part of the application classpath.
Starting with release *datasketches-memory-4.0.0*, this Memory component supports only Java 17 when compiling from source and should work with later Java versions at runtime.

### *NOTE: The DataSketches Java Memory Component is not thread-safe.*

Expand Down
17 changes: 0 additions & 17 deletions src/main/java/org/apache/datasketches/memory/internal/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,15 @@
import static org.apache.datasketches.memory.internal.ResourceImpl.LS;

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Objects;

/**
* @author Lee Rhodes
*/
//@SuppressWarnings("javadoc")
final class Util {

private Util() { }
Expand Down Expand Up @@ -149,18 +146,4 @@ static File getResourceFile(final String shortFileName) {
return new File(getResourcePath(shortFileName));
}

/**
* Returns a byte array of the contents of the file defined by the given resource file's shortFileName.
* @param shortFileName the last name in the pathname's name sequence.
* @return a byte array of the contents of the file defined by the given resource file's shortFileName.
* @throws IllegalArgumentException if resource cannot be read.
*/
static byte[] getResourceBytes(final String shortFileName) {
try {
return Files.readAllBytes(Paths.get(getResourcePath(shortFileName)));
} catch (final IOException e) {
throw new IllegalArgumentException("Cannot read resource: " + shortFileName + LS + e);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,13 @@

public class AllocateDirectMapMemoryTest {

@Test(expectedExceptions = IllegalStateException.class)
@Test
public void simpleMap() throws IOException {
File file = getResourceFile("GettysburgAddress.txt");
file.setReadOnly();
Memory mem2;
File file = UtilTest.setGettysburgAddressFileToReadOnly();
try (Memory mem = Memory.map(file)) {
mem2 = mem;
mem.close();
} //The Try-With-Resources will throw if already closed
assertFalse(mem2.isAlive());
} //The Try-With-Resources will throw since it is already closed
catch (IllegalStateException e) { /* OK */ }
}

@Test
Expand Down Expand Up @@ -94,11 +91,11 @@ public void testLoad() throws IOException {
long memCapacity = file.length();
try (Memory mem = Memory.map(file, 0, memCapacity, ByteOrder.nativeOrder())) {
mem.load();
assertTrue(mem.isLoaded());
//assertTrue(mem.isLoaded()); //incompatible with Windows
assertTrue(mem.isAlive());
}
}

@SuppressWarnings("resource")
@Test
public void testScopeHandle() throws IOException {
File file = getResourceFile("GettysburgAddress.txt");
Expand All @@ -107,7 +104,7 @@ public void testScopeHandle() throws IOException {
ResourceScope scope = mem.scope();
ResourceScope.Handle handle = scope.acquire();
mem.load();
assertTrue(mem.isLoaded());
//assertTrue(mem.isLoaded()); //incompatible with Windows
mem.scope().release(handle);
assertTrue(mem.isAlive());
mem.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public void checkDefaultMemoryRequestServer() {
}
}

@SuppressWarnings("resource")
@Test
public void checkNonNativeDirect() {
MemoryRequestServer myMemReqSvr = Resource.defaultMemReqSvr;
Expand All @@ -86,7 +85,6 @@ public void checkNonNativeDirect() {
}
}

@SuppressWarnings("resource")
@Test
public void checkExplicitCloseNoTWR() {
final long cap = 128;
Expand Down
Loading

0 comments on commit 79fc105

Please sign in to comment.