All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.yudichev.jiotty.common.lang.BaseIdempotentCloseable Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
package net.yudichev.jiotty.common.lang;

import java.util.concurrent.atomic.AtomicBoolean;

public abstract class BaseIdempotentCloseable implements Closeable {
    private final AtomicBoolean closed = new AtomicBoolean();

    @Override
    public final void close() {
        if (!closed.getAndSet(true)) {
            doClose();
        }
    }

    protected abstract void doClose();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy