com.emc.mongoose.common.supply.async.AsyncPatternDefinedSupplier 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.supply.async;
import com.emc.mongoose.common.exception.OmgDoesNotPerformException;
import com.emc.mongoose.common.exception.UserShootHisFootException;
import com.emc.mongoose.common.supply.RangePatternDefinedSupplier;
import com.emc.mongoose.common.supply.PatternDefinedSupplier;
public final class AsyncPatternDefinedSupplier
extends AsyncUpdatingValueSupplier
implements PatternDefinedSupplier {
private final PatternDefinedSupplier wrappedSupplier;
public AsyncPatternDefinedSupplier(final String pattern)
throws UserShootHisFootException {
this(new RangePatternDefinedSupplier(pattern, AsyncStringSupplierFactory.getInstance()));
}
private AsyncPatternDefinedSupplier(final PatternDefinedSupplier wrappedSupplier)
throws OmgDoesNotPerformException {
super(
null,
new InitializedCallableBase() {
private final StringBuilder result = new StringBuilder();
@Override
public final String call()
throws Exception {
result.setLength(0);
return wrappedSupplier.format(result);
}
}
);
this.wrappedSupplier = wrappedSupplier;
}
@Override
public String getPattern() {
return wrappedSupplier.getPattern();
}
@Override
public String format(final StringBuilder result) {
return wrappedSupplier.format(result);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy