From 68a3cec5e32e54581ab4a71b632c92f43721d4ea Mon Sep 17 00:00:00 2001 From: msrocka Date: Wed, 11 Dec 2019 09:05:21 +0100 Subject: [PATCH] we will not add the Cleaner API calls for now but just reference to issue #17 in comments --- .../core/matrix/io/npy/DenseReader.java | 6 ++++ .../core/matrix/io/npy/HeaderTest.java | 28 +++---------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/olca-core/src/main/java/org/openlca/core/matrix/io/npy/DenseReader.java b/olca-core/src/main/java/org/openlca/core/matrix/io/npy/DenseReader.java index ac68f1c5d..772c4d7c6 100644 --- a/olca-core/src/main/java/org/openlca/core/matrix/io/npy/DenseReader.java +++ b/olca-core/src/main/java/org/openlca/core/matrix/io/npy/DenseReader.java @@ -42,6 +42,12 @@ DenseMatrix run() { } } } + buf.force(); + + // there is no way to close the buffer here + // see: https://github.com/GreenDelta/olca-modules/issues/17 + // System.gc(); + return matrix; } catch (IOException e) { throw new RuntimeException("failed to read from " + file, e); diff --git a/olca-core/src/test/java/org/openlca/core/matrix/io/npy/HeaderTest.java b/olca-core/src/test/java/org/openlca/core/matrix/io/npy/HeaderTest.java index 432a75889..0be45a66b 100644 --- a/olca-core/src/test/java/org/openlca/core/matrix/io/npy/HeaderTest.java +++ b/olca-core/src/test/java/org/openlca/core/matrix/io/npy/HeaderTest.java @@ -3,12 +3,8 @@ import org.junit.Assert; import org.junit.Test; import org.openlca.core.matrix.format.DenseMatrix; -import sun.misc.Cleaner; import java.io.File; -import java.io.RandomAccessFile; -import java.nio.MappedByteBuffer; -import java.nio.channels.FileChannel; import java.nio.file.Files; public class HeaderTest { @@ -35,26 +31,10 @@ public void testFromReadFile() throws Exception { Assert.assertEquals("