Debian Codegraph @

src/main/org/h2/store/fs/retry/FilePathRetryOnInterrupt.java

raw
1 /*
2 * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (https://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6 package org.h2.store.fs.retry;
7
8 import java.io.IOException;
9 import java.nio.channels.FileChannel;
10 import org.h2.store.fs.FilePathWrapper;
11
12 /**
13 * A file system that re-opens and re-tries the operation if the file was
14 * closed, because a thread was interrupted. This will clear the interrupt flag.
15 * It is mainly useful for applications that call Thread.interrupt by mistake.
16 */
17 public class FilePathRetryOnInterrupt extends FilePathWrapper {
18
19 /**
20 * The prefix.
21 */
22 static final String SCHEME = "retry";
23
24 @Override
25 public FileChannel open(String mode) throws IOException {
26 return new FileRetryOnInterrupt(name.substring(getScheme().length() + 1), mode);
27 }
28
29 @Override
30 public String getScheme() {
31 return SCHEME;
32 }
33
34 }
35