Skip to content

Commit 6ae79bb

Browse files
committed
make service threadsafe (within a service instance)
1 parent c8956e2 commit 6ae79bb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/cryptomator/linux/autostart/FreedesktopAutoStartService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public FreedesktopAutoStartService() {
5252
}
5353

5454
@Override
55-
public void enable() throws ToggleAutoStartFailedException {
55+
public synchronized void enable() throws ToggleAutoStartFailedException {
5656
try {
5757
Files.writeString(autostartFile, content, StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING);
5858
} catch (IOException e) {
@@ -61,7 +61,7 @@ public void enable() throws ToggleAutoStartFailedException {
6161
}
6262

6363
@Override
64-
public void disable() throws ToggleAutoStartFailedException {
64+
public synchronized void disable() throws ToggleAutoStartFailedException {
6565
try {
6666
Files.deleteIfExists(autostartFile);
6767
} catch (IOException e) {
@@ -70,7 +70,7 @@ public void disable() throws ToggleAutoStartFailedException {
7070
}
7171

7272
@Override
73-
public boolean isEnabled() {
73+
public synchronized boolean isEnabled() {
7474
return Files.exists(autostartFile);
7575
}
7676

0 commit comments

Comments
 (0)