com.emc.mongoose.common.collection.OptLockArrayBuffer 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.collection;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
Created by andrey on 31.03.17.
*/
public final class OptLockArrayBuffer
extends ArrayList
implements OptLockBuffer {
private final Lock lock = new ReentrantLock();
public OptLockArrayBuffer(final int initialCapacity) {
super(initialCapacity);
}
@Override
public final void removeRange(int fromIndex, int toIndex) {
super.removeRange(fromIndex, toIndex);
}
@Override
public final void lock() {
lock.lock();
}
@Override
public final void lockInterruptibly()
throws InterruptedException {
lock.lockInterruptibly();
}
@Override
public final boolean tryLock() {
return lock.tryLock();
}
@Override
public final boolean tryLock(final long time, final TimeUnit unit)
throws InterruptedException {
return lock.tryLock(time, unit);
}
@Override
public final void unlock() {
lock.unlock();
}
@Override
public final Condition newCondition() {
return lock.newCondition();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy