All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lucee.runtime.lock.LockManager Maven / Gradle / Ivy

There is a newer version: 6.2.0.284-RC
Show newest version
/**
 *
 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either 
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public 
 * License along with this library.  If not, see .
 * 
 **/
package lucee.runtime.lock;

/**
 * Manager to open and close locks
 */
public interface LockManager {

	/**
	 * Field TYPE_READONLY
	 */
	public static final int TYPE_READONLY = 0;

	/**
	 * Field TYPE_EXCLUSIVE
	 */
	public static final int TYPE_EXCLUSIVE = 1;

	/**
	 * locks a thread if already another thread is come until other thread notify him by unlock method
	 * 
	 * @param type Local Type
	 * @param name Lock Name (not case sensitive)
	 * @param timeout timeout to for waiting in this method, if timeout occurs "lockTimeoutException"
	 *            will be thrown
	 * @param pageContextId page context id
	 * @return lock data object key for unlocking this lock
	 * @throws LockTimeoutException Lock Timeout Exception
	 * @throws InterruptedException Interrupted Exception
	 */
	public abstract LockData lock(int type, String name, int timeout, int pageContextId) throws LockTimeoutException, InterruptedException;

	/**
	 * unlocks a locked thread in lock method
	 * 
	 * @param data data
	 */
	public abstract void unlock(LockData data);

	public String[] getOpenLockNames();

	public abstract void clean();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy