2020
2121import org .apache .paimon .disk .FileIOChannel ;
2222
23- import java .io .Closeable ;
2423import java .io .File ;
2524import java .util .HashSet ;
2625import java .util .Iterator ;
2726import java .util .List ;
2827
29- import static org .apache .paimon .utils .Preconditions .checkArgument ;
30-
3128/** Channel manager to manage the life cycle of spill channels. */
32- public class SpillChannelManager implements Closeable {
29+ public class SpillChannelManager {
3330
3431 private final HashSet <FileIOChannel .ID > channels ;
3532 private final HashSet <FileIOChannel > openChannels ;
3633
37- private volatile boolean closed ;
38-
3934 public SpillChannelManager () {
4035 this .channels = new HashSet <>(64 );
4136 this .openChannels = new HashSet <>(64 );
4237 }
4338
4439 /** Add a new File channel. */
4540 public synchronized void addChannel (FileIOChannel .ID id ) {
46- checkArgument (!closed );
4741 channels .add (id );
4842 }
4943
5044 /** Open File channels. */
5145 public synchronized void addOpenChannels (List <FileIOChannel > toOpen ) {
52- checkArgument (!closed );
5346 for (FileIOChannel channel : toOpen ) {
5447 openChannels .add (channel );
5548 channels .remove (channel .getChannelID ());
5649 }
5750 }
5851
5952 public synchronized void removeChannel (FileIOChannel .ID id ) {
60- checkArgument (!closed );
6153 channels .remove (id );
6254 }
6355
@@ -84,13 +76,4 @@ public synchronized void reset() {
8476 }
8577 }
8678 }
87-
88- @ Override
89- public synchronized void close () {
90- if (this .closed ) {
91- return ;
92- }
93- this .closed = true ;
94- reset ();
95- }
9679}
0 commit comments