com.emc.mongoose.common.concurrent.SvcTaskBase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongoose-common Show documentation
Show all versions of mongoose-common Show documentation
Mongoose is a high-load storage performance testing tool
The newest version!
package com.emc.mongoose.common.concurrent;
import java.io.IOException;
import java.util.List;
/**
Created by andrey on 19.04.17.
*/
public abstract class SvcTaskBase
implements SvcTask {
private final List svcTasks;
private volatile boolean isClosedFlag = false;
protected SvcTaskBase(final List svcTasks) {
this.svcTasks = svcTasks;
}
@Override
public final void close()
throws IOException {
isClosedFlag = true;
svcTasks.remove(this);
doClose();
}
@Override
public void run() {
if(!isClosedFlag) {
invoke();
}
}
@Override
public final boolean isClosed() {
return isClosedFlag;
}
protected abstract void invoke();
protected abstract void doClose()
throws IOException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy