File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
ProtocolLib/src/main/java/com/comphenix/protocol/utility Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 16
16
*/
17
17
package com .comphenix .protocol .utility ;
18
18
19
+ import java .io .Closeable ;
19
20
import java .util .ArrayList ;
20
21
import java .util .List ;
21
22
22
23
/**
23
24
* @author dmulloy2
24
25
*/
25
26
26
- public class Closer implements AutoCloseable {
27
- private final List <AutoCloseable > list ;
27
+ // TODO Switch to AutoCloseable w/ Java 7
28
+ public class Closer implements Closeable {
29
+ private final List <Closeable > list ;
28
30
29
31
private Closer () {
30
- this .list = new ArrayList <AutoCloseable >();
32
+ this .list = new ArrayList <Closeable >();
31
33
}
32
34
33
35
public static Closer create () {
34
36
return new Closer ();
35
37
}
36
38
37
- public <C extends AutoCloseable > C register (C close ) {
39
+ public <C extends Closeable > C register (C close ) {
38
40
list .add (close );
39
41
return close ;
40
42
}
41
43
42
44
@ Override
43
45
public void close () {
44
- for (AutoCloseable close : list ) {
46
+ for (Closeable close : list ) {
45
47
closeQuietly (close );
46
48
}
47
49
}
48
50
49
- public static void closeQuietly (AutoCloseable close ) {
51
+ public static void closeQuietly (Closeable close ) {
50
52
try {
51
53
close .close ();
52
54
} catch (Throwable ex ) { }
You can’t perform that action at this time.
0 commit comments