diff --git a/jfuse-api/pom.xml b/jfuse-api/pom.xml index e6bf9542..a123e300 100644 --- a/jfuse-api/pom.xml +++ b/jfuse-api/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.2 + 0.3.3 4.0.0 jfuse-api diff --git a/jfuse-api/src/main/java/module-info.java b/jfuse-api/src/main/java/module-info.java index 92a897db..45a46b4f 100644 --- a/jfuse-api/src/main/java/module-info.java +++ b/jfuse-api/src/main/java/module-info.java @@ -9,6 +9,7 @@ requires static org.jetbrains.annotations; exports org.cryptomator.jfuse.api; + exports org.cryptomator.jfuse.api.platforms to org.cryptomator.jfuse.linux.aarch64, org.cryptomator.jfuse.linux.amd64, org.cryptomator.jfuse.mac, org.cryptomator.jfuse.win; uses FuseBuilder; } \ No newline at end of file diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java index bf21ec4f..975af65f 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java @@ -165,19 +165,24 @@ private int fuseLoop(FuseMount mount) { /** * Unmounts (if needed) this fuse file system and frees up system resources. *

+ * This method is idempotent and closing multiple times will be no-op. + *

* Important: Before closing, a graceful unmount via system tools (e.g. {@code fusermount -u}) should be attempted. */ @Override @Blocking @MustBeInvokedByOverriders - public void close() throws TimeoutException { + public synchronized void close() throws TimeoutException { + if (!fuseScope.isAlive()) { + return; // already closed + } try { var fuseMount = this.mount.getAndSet(UNMOUNTED); fuseMount.unmount(); executor.shutdown(); boolean exited = executor.awaitTermination(10, TimeUnit.SECONDS); if (!exited) { - throw new TimeoutException("fuse main loop continued runn"); + throw new TimeoutException("fuse main loop continued run"); } fuseMount.destroy(); } catch (InterruptedException e) { diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseBuilder.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseBuilder.java index d7bca7c6..1f6bf48e 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseBuilder.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseBuilder.java @@ -1,5 +1,8 @@ package org.cryptomator.jfuse.api; +import org.cryptomator.jfuse.api.platforms.Architecture; +import org.cryptomator.jfuse.api.platforms.OperatingSystem; +import org.cryptomator.jfuse.api.platforms.SupportedPlatform; import org.jetbrains.annotations.Nullable; import java.util.Arrays; diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Architecture.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/platforms/Architecture.java similarity index 93% rename from jfuse-api/src/main/java/org/cryptomator/jfuse/api/Architecture.java rename to jfuse-api/src/main/java/org/cryptomator/jfuse/api/platforms/Architecture.java index 4760ef6f..40fc5770 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Architecture.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/platforms/Architecture.java @@ -1,4 +1,4 @@ -package org.cryptomator.jfuse.api; +package org.cryptomator.jfuse.api.platforms; /** * CPU architecture diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/OperatingSystem.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/platforms/OperatingSystem.java similarity index 93% rename from jfuse-api/src/main/java/org/cryptomator/jfuse/api/OperatingSystem.java rename to jfuse-api/src/main/java/org/cryptomator/jfuse/api/platforms/OperatingSystem.java index c374d90d..78ca8a2d 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/OperatingSystem.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/platforms/OperatingSystem.java @@ -1,4 +1,4 @@ -package org.cryptomator.jfuse.api; +package org.cryptomator.jfuse.api.platforms; /** * Operating System diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/SupportedPlatform.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/platforms/SupportedPlatform.java similarity index 90% rename from jfuse-api/src/main/java/org/cryptomator/jfuse/api/SupportedPlatform.java rename to jfuse-api/src/main/java/org/cryptomator/jfuse/api/platforms/SupportedPlatform.java index d5592cb6..ffe6190f 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/SupportedPlatform.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/platforms/SupportedPlatform.java @@ -1,4 +1,6 @@ -package org.cryptomator.jfuse.api; +package org.cryptomator.jfuse.api.platforms; + +import org.cryptomator.jfuse.api.FuseBuilder; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/SupportedPlatforms.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/platforms/SupportedPlatforms.java similarity index 92% rename from jfuse-api/src/main/java/org/cryptomator/jfuse/api/SupportedPlatforms.java rename to jfuse-api/src/main/java/org/cryptomator/jfuse/api/platforms/SupportedPlatforms.java index ecb5c62d..e1025d2d 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/SupportedPlatforms.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/platforms/SupportedPlatforms.java @@ -1,4 +1,4 @@ -package org.cryptomator.jfuse.api; +package org.cryptomator.jfuse.api.platforms; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/jfuse-examples/pom.xml b/jfuse-examples/pom.xml index 29539f2b..f107c22f 100644 --- a/jfuse-examples/pom.xml +++ b/jfuse-examples/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.2 + 0.3.3 4.0.0 jfuse-examples diff --git a/jfuse-linux-aarch64/pom.xml b/jfuse-linux-aarch64/pom.xml index 913fcf58..acf929c1 100644 --- a/jfuse-linux-aarch64/pom.xml +++ b/jfuse-linux-aarch64/pom.xml @@ -5,7 +5,7 @@ jfuse-parent org.cryptomator - 0.3.2 + 0.3.3 4.0.0 jfuse-linux-aarch64 diff --git a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/LinuxFuseBuilder.java b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/LinuxFuseBuilder.java index 67ce2f5f..11842b17 100644 --- a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/LinuxFuseBuilder.java +++ b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/LinuxFuseBuilder.java @@ -1,12 +1,12 @@ package org.cryptomator.jfuse.linux.aarch64; -import org.cryptomator.jfuse.api.Architecture; import org.cryptomator.jfuse.api.Errno; import org.cryptomator.jfuse.api.Fuse; import org.cryptomator.jfuse.api.FuseBuilder; import org.cryptomator.jfuse.api.FuseOperations; -import org.cryptomator.jfuse.api.OperatingSystem; -import org.cryptomator.jfuse.api.SupportedPlatform; +import org.cryptomator.jfuse.api.platforms.Architecture; +import org.cryptomator.jfuse.api.platforms.OperatingSystem; +import org.cryptomator.jfuse.api.platforms.SupportedPlatform; /** * Builds FUSE file system instances on Linux (aarch64). diff --git a/jfuse-linux-amd64/pom.xml b/jfuse-linux-amd64/pom.xml index 398e4649..456ff258 100644 --- a/jfuse-linux-amd64/pom.xml +++ b/jfuse-linux-amd64/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.2 + 0.3.3 4.0.0 jfuse-linux-amd64 diff --git a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/LinuxFuseBuilder.java b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/LinuxFuseBuilder.java index e122f14c..24ef1284 100644 --- a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/LinuxFuseBuilder.java +++ b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/LinuxFuseBuilder.java @@ -1,12 +1,12 @@ package org.cryptomator.jfuse.linux.amd64; -import org.cryptomator.jfuse.api.Architecture; import org.cryptomator.jfuse.api.Errno; import org.cryptomator.jfuse.api.Fuse; import org.cryptomator.jfuse.api.FuseBuilder; import org.cryptomator.jfuse.api.FuseOperations; -import org.cryptomator.jfuse.api.OperatingSystem; -import org.cryptomator.jfuse.api.SupportedPlatform; +import org.cryptomator.jfuse.api.platforms.Architecture; +import org.cryptomator.jfuse.api.platforms.OperatingSystem; +import org.cryptomator.jfuse.api.platforms.SupportedPlatform; /** * Builds FUSE file system instances on Linux (x86_64). diff --git a/jfuse-mac/pom.xml b/jfuse-mac/pom.xml index 93fe5e47..c9671817 100644 --- a/jfuse-mac/pom.xml +++ b/jfuse-mac/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.2 + 0.3.3 4.0.0 jfuse-mac diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/MacFuseBuilder.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/MacFuseBuilder.java index 933c8695..e78c04cb 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/MacFuseBuilder.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/MacFuseBuilder.java @@ -1,12 +1,12 @@ package org.cryptomator.jfuse.mac; -import org.cryptomator.jfuse.api.Architecture; import org.cryptomator.jfuse.api.Errno; import org.cryptomator.jfuse.api.Fuse; import org.cryptomator.jfuse.api.FuseBuilder; import org.cryptomator.jfuse.api.FuseOperations; -import org.cryptomator.jfuse.api.OperatingSystem; -import org.cryptomator.jfuse.api.SupportedPlatform; +import org.cryptomator.jfuse.api.platforms.Architecture; +import org.cryptomator.jfuse.api.platforms.OperatingSystem; +import org.cryptomator.jfuse.api.platforms.SupportedPlatform; import java.nio.file.Files; import java.nio.file.Path; diff --git a/jfuse-tests/pom.xml b/jfuse-tests/pom.xml index b851b77a..f09be207 100644 --- a/jfuse-tests/pom.xml +++ b/jfuse-tests/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.2 + 0.3.3 4.0.0 jfuse-tests diff --git a/jfuse-win/pom.xml b/jfuse-win/pom.xml index 89409a22..f475c73d 100644 --- a/jfuse-win/pom.xml +++ b/jfuse-win/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.2 + 0.3.3 4.0.0 jfuse-win diff --git a/jfuse-win/src/main/java/org/cryptomator/jfuse/win/WinFuseBuilder.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/WinFuseBuilder.java index 99c3a3aa..64f0b94b 100644 --- a/jfuse-win/src/main/java/org/cryptomator/jfuse/win/WinFuseBuilder.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/WinFuseBuilder.java @@ -1,12 +1,12 @@ package org.cryptomator.jfuse.win; -import org.cryptomator.jfuse.api.Architecture; import org.cryptomator.jfuse.api.Errno; import org.cryptomator.jfuse.api.Fuse; import org.cryptomator.jfuse.api.FuseBuilder; import org.cryptomator.jfuse.api.FuseOperations; -import org.cryptomator.jfuse.api.OperatingSystem; -import org.cryptomator.jfuse.api.SupportedPlatform; +import org.cryptomator.jfuse.api.platforms.Architecture; +import org.cryptomator.jfuse.api.platforms.OperatingSystem; +import org.cryptomator.jfuse.api.platforms.SupportedPlatform; /** * Builds FUSE file system instances on Windows. diff --git a/jfuse/pom.xml b/jfuse/pom.xml index 683a1f83..20dfa0d7 100644 --- a/jfuse/pom.xml +++ b/jfuse/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.2 + 0.3.3 4.0.0 jfuse diff --git a/pom.xml b/pom.xml index 31ab770a..2608adca 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.cryptomator jfuse-parent pom - 0.3.2 + 0.3.3 jFUSE Java bindings for FUSE using foreign functions & memory API https://github.com/cryptomator/jfuse