Example usage for org.apache.commons.transaction.locking MultiLevelLock release

List of usage examples for org.apache.commons.transaction.locking MultiLevelLock release

Introduction

In this page you can find the example usage for org.apache.commons.transaction.locking MultiLevelLock release.

Prototype

public boolean release(Object ownerId);

Source Link

Document

Releases any lock levels the specified owner may hold on this lock.

Usage

From source file:de.innovationgate.wgpublisher.WGPDeployer.java

public String locateTmlResource(WGTMLModule tmlLib, ServletRequest servletRequest)
        throws WGAPIException, DeployerException {

    DesignReference ref = WGADesignManager.createDesignReference(tmlLib);

    DeployedLayout layout = getDeployedLayout(tmlLib, ref);
    if (layout == null) {
        MultiLevelLock lock = _lockManager.atomicGetOrCreateLock(ref.toString());
        try {//ww w  .j av  a2s.c  o  m
            try {
                lock.acquire(Thread.currentThread(), 1, true, true, Long.MAX_VALUE);
            } catch (InterruptedException e) {
            }

            layout = getDeployedLayout(tmlLib, ref);
            if (layout == null) {
                servletRequest.setAttribute(REQATTRIB_TML_DEPLOYED, true);
                layout = deployTML(tmlLib);
            }
        } finally {
            lock.release(Thread.currentThread());
        }
    }

    return layout.getResourcePath();

}