org.uberfire.commons.lock.LockExecuteReleaseTemplate Maven / Gradle / Ivy
package org.uberfire.commons.lock;
import java.util.concurrent.RunnableFuture;
public class LockExecuteReleaseTemplate {
public V execute( final LockService lock,
final RunnableFuture task ) {
try {
lock.lock();
task.run();
return task.get();
} catch ( final Exception e ) {
throw new RuntimeException( e );
} finally {
lock.unlock();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy