Skip to content

Commit

Permalink
Merge a310fe9 into 413136b
Browse files Browse the repository at this point in the history
  • Loading branch information
davecromberge committed Jul 14, 2021
2 parents 413136b + a310fe9 commit 22b0605
Show file tree
Hide file tree
Showing 53 changed files with 391 additions and 421 deletions.
1 change: 1 addition & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
mvn package
-Dmaven.javadoc.skip=true
-Dgpg.skip=true
-Denvironment=ci
--toolchains .github/workflows/.toolchains.xml
- name: Test & Report
Expand Down
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# ignore .gitignore in sub module projects
datasketches-memory*/.gitignore

# Eclipse project files
.classpath
.project
Expand All @@ -11,14 +14,14 @@
*.iws

# Additional tools
.clover/
.clover

#OSX files
.DS_Store

# Compiler output, class files
*.class
bin/
bin

# Log file
*.log
Expand All @@ -45,7 +48,7 @@ test-output/
local/
reports/
.pmd
tmp/
tmp

# Build artifacts
target/
Expand Down
60 changes: 0 additions & 60 deletions .lgtm.yml

This file was deleted.

24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ module datasketches.memory.multirelease.test {
## Build Instructions
__NOTE:__ This component accesses resource files for testing. As a result, the directory elements of the full absolute path of the target installation directory must qualify as Java identifiers. In other words, the directory elements must not have any space characters (or non-Java identifier characters) in any of the path elements. This is required by the Oracle Java Specification in order to ensure location-independent access to resources: [See Oracle Location-Independent Access to Resources](https://docs.oracle.com/javase/8/docs/technotes/guides/lang/resources.html)

__IMPORTANT:__ This project is structured as a maven multi-module project. Building this project might affect plugins that require early dependency resolution, such as the javadoc and eclipse plugins. The build instructions below have been modified to use the `process-classes` phase (instead of `compile`) for these use cases. For more information, see [this Maven Reactor issue](https://issues.apache.org/jira/browse/MNG-3283).

### JDK versions required to compile
This DataSketches component is pure Java and requires the following JDKs to compile:
- JDK8/Hotspot
Expand All @@ -95,9 +97,11 @@ To run the strict profile tests:

To run javadoc on this multi-module project, use:

$ mvn clean package javadoc:javadoc -DskipTests=true
$ mvn clean process-classes javadoc:javadoc -DskipTests=true

To run the eclipse plugin on this multi-module project, use:

* There are sometimes problems resolving module deps, e.g. see https://issues.apache.org/jira/browse/MJAVADOC-437
$ mvn clean process-classes eclipse:eclipse -DskipTests=true

To install jars built from the downloaded source:

Expand All @@ -114,15 +118,7 @@ This will create the following Jars:
### Toolchains

This project makes use of Maven toolchains to ensure that the correct Java compiler version is used when compiling source files.

The reference toolchains.xml can be found in .github/workflows/.toolchains.xml, and can be copied to your local maven home
directory e.g. `~/.m2/toolchains.xml`.

Alternatively, the maven commands above can be supplemented with: `--toolchains .github/workflows/.toolchains.xml`

For example, to run normal unit tests:

$ mvn clean test --toolchains .github/workflows/.toolchains.xml
Ensure that your local environment has been configured according to the [toolchain documentation](docs/maven-toolchains.md).

### Dependencies

Expand All @@ -138,7 +134,11 @@ See the pom.xml file for test dependencies.
For more information on the project configuration, the following topics are discussed in more detail:

* [Maven configuration](docs/maven.md)
* [Maven toolchain configuration](docs/maven-toolchains.md)
* [Multi-release jar](docs/multi-release-jar.md)
* [Java Platform Module System](docs/module-system.md)

In order to build and contribute to this project, please read the [development setup documentation](docs/development.md).
In order to build and contribute to this project, please read the relevant IDE documentation:

- [Eclipse IDE](docs/eclipse.md)
- [IntelliJ IDE](docs/intellij.md)
1 change: 1 addition & 0 deletions datasketches-memory-java11/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

<artifactId>datasketches-memory-java11</artifactId>
<name>${project.artifactId}</name>
<packaging>jar</packaging>

<properties>
<java.version>11</java.version>
Expand Down
4 changes: 1 addition & 3 deletions datasketches-memory-java8-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,25 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- Used for UTF8 testing -->
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf-java.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- Used for xxHash testing -->
<groupId>net.openhft</groupId>
<artifactId>zero-allocation-hashing</artifactId>
<version>${zero-allocation-hashing.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<artifactId>datasketches-memory-java8-tests</artifactId>
<name>${project.artifactId}</name>
<packaging>jar</packaging>

<properties>
<java.version>1.8</java.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,23 @@ public class MemoryCleanerTest {
@Test
public void cleanerDeallocates() {
SimpleDeallocator deallocator = new SimpleDeallocator();
org.apache.datasketches.memory.internal.MemoryCleaner cleaner = new org.apache.datasketches.memory.internal.MemoryCleaner(this, deallocator);
MemoryCleaner cleaner = new MemoryCleaner(this, deallocator);
cleaner.clean();
assertTrue(deallocator.getHasRun());
assertTrue(SimpleDeallocator.getHasRun());
}

@SuppressWarnings("unused")
@Test
public void noDeallocation() {
SimpleDeallocator deallocator = new SimpleDeallocator();
org.apache.datasketches.memory.internal.MemoryCleaner cleaner = new MemoryCleaner(this, deallocator);
assertFalse(deallocator.getHasRun());
new MemoryCleaner(this, deallocator);
assertFalse(SimpleDeallocator.getHasRun());
}

private static final class SimpleDeallocator implements Runnable {
static final class SimpleDeallocator implements Runnable {
static final AtomicBoolean hasRun = new AtomicBoolean();

private SimpleDeallocator() {
SimpleDeallocator() {
hasRun.set(false);
}

Expand All @@ -57,7 +58,7 @@ public void run() {
hasRun.compareAndSet(false, true);
}

public Boolean getHasRun() {
public static Boolean getHasRun() {
return hasRun.get();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ private static void checkUnsafeByteBufferView(final Memory mem) {
}
}

@SuppressWarnings({ "resource", "static-access" })
@SuppressWarnings({ "resource"})
@Test
public void checkMonitorDirectStats() throws Exception {
int bytes = 1024;
Expand All @@ -403,7 +403,7 @@ public void checkMonitorDirectStats() throws Exception {
assertEquals(BaseState.getCurrentDirectMemoryAllocated(), 0L);
}

@SuppressWarnings({ "resource", "static-access" })
@SuppressWarnings({ "resource"})
@Test
public void checkMonitorDirectMapStats() throws Exception {
File file = getResourceFile("GettysburgAddress.txt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
/**
* @author Lee Rhodes
*/
@SuppressWarnings({"javadoc","restriction"})
public class UnsafeUtilTest {
long testField = 1; //Do not remove & cannot be static. Used in reflection check.

Expand Down Expand Up @@ -114,6 +113,7 @@ public void checkInts() {
Ints.checkedCast(1L << 32);
}

@SuppressWarnings("restriction")
@Test
public void checkArrayBaseOffset()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@
* under the License.
*/

package org.apache.datasketches.memory.test.internal;
package org.apache.datasketches.memory.test;

import org.apache.datasketches.memory.internal.VirtualMachineMemory;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
@SuppressWarnings({"javadoc","unused"})
public class VirtualMachineMemoryTest {

@Test
public void maxDirectBufferMemory() {
assert(org.apache.datasketches.memory.internal.VirtualMachineMemory.getMaxDBBMemory() >= 0);
assert(VirtualMachineMemory.getMaxDBBMemory() >= 0);
}

@Test
public void inertPageAlignment() {
System.out.println("VM page alignment:" + VirtualMachineMemory.getIsPageAligned());
assert(true);
boolean result = VirtualMachineMemory.getIsPageAligned();
//System.out.println("VM page alignment:" + result);
assert(true); //no exception was thrown
}
}
1 change: 1 addition & 0 deletions datasketches-memory-java8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

<artifactId>datasketches-memory-java8</artifactId>
<name>${project.artifactId}</name>
<packaging>jar</packaging>

<properties>
<java.version>1.8</java.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @author Praveenkumar Venkatesan
* @author Roman Leventov
*/
@SuppressWarnings({"restriction"})
@SuppressWarnings("restriction")
final class AccessByteBuffer {

static final ByteBuffer ZERO_READ_ONLY_DIRECT_BYTE_BUFFER =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
* @author Roman Leventov
* @author Lee Rhodes
*/
@SuppressWarnings({"restriction","synthetic-access"})
@SuppressWarnings("restriction")
final class AllocateDirect {
private static final Logger LOG = Logger.getLogger(AllocateDirect.class.getCanonicalName());
static final Logger LOG = Logger.getLogger(AllocateDirect.class.getCanonicalName());

private final Deallocator deallocator;
private final long nativeBaseOffset;
Expand Down Expand Up @@ -91,14 +91,14 @@ StepBoolean getValid() {
return deallocator.getValid();
}

private static final class Deallocator implements Runnable {
static final class Deallocator implements Runnable {
//This is the only place the actual native address is kept for use by unsafe.freeMemory();
private final long nativeAddress;
private final long allocationSize;
private final long capacity;
private final StepBoolean valid = new StepBoolean(true); //only place for this

private Deallocator(final long nativeAddress, final long allocationSize, final long capacity) {
Deallocator(final long nativeAddress, final long allocationSize, final long capacity) {
BaseStateImpl.currentDirectMemoryAllocations_.incrementAndGet();
BaseStateImpl.currentDirectMemoryAllocated_.addAndGet(capacity);
this.nativeAddress = nativeAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@
* @author Lee Rhodes
* @author Praveenkumar Venkatesan
*/
@SuppressWarnings({"restriction","synthetic-access"})
@SuppressWarnings("restriction")
class AllocateDirectMap implements Map {
private static final Logger LOG = Logger.getLogger(AllocateDirectMap.class.getCanonicalName());
static final Logger LOG = Logger.getLogger(AllocateDirectMap.class.getCanonicalName());

private static final int MAP_RO = 0;
private static final int MAP_RW = 1;

private static final Method FILE_CHANNEL_IMPL_MAP0_METHOD;
private static final Method FILE_CHANNEL_IMPL_UNMAP0_METHOD;
static final Method FILE_CHANNEL_IMPL_UNMAP0_METHOD;

private static final Method MAPPED_BYTE_BUFFER_LOAD0_METHOD;
private static final Method MAPPED_BYTE_BUFFER_ISLOADED0_METHOD;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*
* @author Lee Rhodes
*/
@SuppressWarnings({"restriction"})
@SuppressWarnings("restriction")
public abstract class BaseStateImpl implements BaseState {

//Monitoring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* Common base of native-ordered and non-native-ordered {@link WritableBufferImpl} implementations.
* Contains methods which are agnostic to the byte order.
*/
@SuppressWarnings({"restriction"})
@SuppressWarnings("restriction")
abstract class BaseWritableBufferImpl extends WritableBufferImpl {
final BaseWritableMemoryImpl originMemory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
* Common base of native-ordered and non-native-ordered {@link WritableMemoryImpl} implementations.
* Contains methods which are agnostic to the byte order.
*/
@SuppressWarnings({"restriction"})
@SuppressWarnings("restriction")
abstract class BaseWritableMemoryImpl extends WritableMemoryImpl {

//1KB of empty bytes for speedy clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/**
* @author Lee Rhodes
*/
@SuppressWarnings({"restriction"})
@SuppressWarnings("restriction")
final class CompareAndCopy {

private CompareAndCopy() { }
Expand Down

0 comments on commit 22b0605

Please sign in to comment.