Skip to content
Commits on Source (6)
......@@ -2,3 +2,6 @@ language: java
sudo: false
jdk:
- oraclejdk8
notifications:
email:
- info@sejda.org
libsejda-io-java (1.1.4-1) unstable; urgency=medium
* New upstream version 1.1.4
* Switch to compat level 11.
* Declare compliance with Debian Policy 4.2.1.
-- Markus Koschany <apo@debian.org> Sat, 22 Dec 2018 12:16:31 +0100
libsejda-io-java (1.1.3-2) unstable; urgency=medium
* libsejda-io-java.poms: Remove --has-package-version flag. (Closes: #874494)
......
......@@ -5,12 +5,12 @@ Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.or
Uploaders:
Markus Koschany <apo@debian.org>
Build-Depends:
debhelper (>= 10),
debhelper (>= 11),
default-jdk,
libcommons-io-java,
libslf4j-java (>= 1.7.21),
maven-debian-helper (>= 2.1)
Standards-Version: 4.0.0
Standards-Version: 4.2.1
Vcs-Git: https://anonscm.debian.org/git/pkg-java/libsejda-io-java.git
Vcs-Browser: https://anonscm.debian.org/git/pkg-java/libsejda-io-java.git
Homepage: http://www.sejda.org
......
version=4
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/sejda-io-$1\.tar\.gzi/,\
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/sejda-io-$1\.tar\.gz/,\
uversionmangle=s/_/./g;s/\.RELEASE// \
https://github.com/torakiki/sejda-io/tags .*/v?(\d\S+)\.tar\.gz
......@@ -5,7 +5,7 @@
<artifactId>sejda-io</artifactId>
<packaging>jar</packaging>
<name>sejda-io</name>
<version>1.1.3.RELEASE</version>
<version>1.1.4</version>
<description>An Input/Output layer built on top of Java standard io and nio packages</description>
<url>http://www.sejda.org</url>
......@@ -37,7 +37,7 @@
<connection>scm:git:git@github.com:torakiki/sejda-io.git</connection>
<developerConnection>scm:git:git@github.com:torakiki/sejda-io.git</developerConnection>
<url>scm:git:git@github.com:torakiki/sejda-io.git</url>
<tag>v1.1.3.RELEASE</tag>
<tag>v1.1.4</tag>
</scm>
<developers>
......@@ -85,7 +85,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
<version>2.5.3</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
<preparationGoals>clean install</preparationGoals>
......@@ -115,7 +115,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
......@@ -126,12 +126,19 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<version>3.1.0</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>org.sejda.io</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
......@@ -147,17 +154,17 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
<version>2.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
......
......@@ -27,6 +27,8 @@ import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
import org.sejda.util.IOUtils;
import org.slf4j.Logger;
......@@ -49,6 +51,7 @@ public class MemoryMappedSeekableSource extends BaseSeekableSource {
private long size;
private ThreadBoundCopiesSupplier<MemoryMappedSeekableSource> localCopiesSupplier = new ThreadBoundCopiesSupplier<>(
() -> new MemoryMappedSeekableSource(this));
private Consumer<? super ByteBuffer> unmapper = IOUtils::unmap;
public MemoryMappedSeekableSource(File file) throws IOException {
super(ofNullable(file).map(File::getAbsolutePath).orElseThrow(() -> {
......@@ -74,6 +77,8 @@ public class MemoryMappedSeekableSource extends BaseSeekableSource {
for (ByteBuffer page : parent.pages) {
this.pages.add(page.duplicate());
}
// unmap doesn't work on duplicate, see Unsafe#invokeCleaner
this.unmapper = null;
}
@Override
......@@ -146,7 +151,7 @@ public class MemoryMappedSeekableSource extends BaseSeekableSource {
public void close() throws IOException {
super.close();
IOUtils.close(localCopiesSupplier);
pages.stream().forEach(IOUtils::unmap);
Optional.ofNullable(unmapper).ifPresent(m -> pages.stream().forEach(m));
pages.clear();
}
......
......@@ -39,7 +39,7 @@ public interface SeekableSource extends ReadableByteChannel {
/**
* Sets the source position. Setting the position to a value that is greater than the source's size is legal but does not change the size of the source. A later attempt to read
* bytes at such a position will immediately
* bytes at such a position will immediately return an end-of-file indication.
*
* @param position
* a non-negative long for the new position
......
......@@ -54,8 +54,8 @@ public final class IOUtils {
private static final Optional<Consumer<ByteBuffer>> UNMAPPER;
static {
UNMAPPER = Optional
.ofNullable(AccessController.doPrivileged((PrivilegedAction<Consumer<ByteBuffer>>) IOUtils::unmapper));
UNMAPPER = Optional.ofNullable(
AccessController.doPrivileged((PrivilegedAction<Consumer<ByteBuffer>>) IOUtils::unmapper));
}
private IOUtils() {
......@@ -110,13 +110,11 @@ public final class IOUtils {
* @param buf
*/
public static void unmap(ByteBuffer buf) {
UNMAPPER.ifPresent(u -> {
try {
u.accept(buf);
UNMAPPER.ifPresent(u -> u.accept(buf));
} catch (Exception e) {
LOG.error("Unable to unmap ByteBuffer.", e);
}
});
}
/**
......@@ -157,9 +155,8 @@ public final class IOUtils {
* needs ELSE } }
*/
final MethodHandle cleanMethod = lookup.findVirtual(cleanerClass, "clean", methodType(void.class));
final MethodHandle nonNullTest = lookup
.findStatic(Objects.class, "nonNull", methodType(boolean.class, Object.class))
.asType(methodType(boolean.class, cleanerClass));
final MethodHandle nonNullTest = lookup.findStatic(Objects.class, "nonNull",
methodType(boolean.class, Object.class)).asType(methodType(boolean.class, cleanerClass));
final MethodHandle noop = dropArguments(constant(Void.class, null).asType(methodType(void.class)), 0,
cleanerClass);
final MethodHandle unmapper = filterReturnValue(directBufferCleanerMethod,
......