Skip to content

Commit 7bb3598

Browse files
committed
Make timeout static
1 parent 3c0c855 commit 7bb3598

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/main/java/org/embulk/output/sftp/utils/TimeoutCloser.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
public class TimeoutCloser implements Closeable
1212
{
13-
@VisibleForTesting
14-
int timeout = 300; // 5 minutes
13+
private static int timeout = 300; // 5 minutes
1514
private Closeable wrapped;
1615

1716
public TimeoutCloser(Closeable wrapped)
@@ -39,4 +38,10 @@ public Void call() throws Exception
3938
throw Throwables.propagate(e);
4039
}
4140
}
41+
42+
@VisibleForTesting
43+
public static void setTimeout(int timeout)
44+
{
45+
TimeoutCloser.timeout = timeout;
46+
}
4247
}

src/test/java/org/embulk/output/sftp/utils/TestTimeoutCloser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void close()
3232
}
3333
}
3434
});
35-
closer.timeout = 1;
35+
TimeoutCloser.setTimeout(1);
3636
try {
3737
closer.close();
3838
fail("Should not finish");

0 commit comments

Comments
 (0)