001    package railo.runtime.lock;
002    
003    
004    /**
005     * Manager to open and close locks
006     */
007    public interface LockManager {
008    
009        /**
010         * Field <code>TYPE_READONLY</code>
011         */
012        public static final int TYPE_READONLY = 0;
013    
014        /**
015         * Field <code>TYPE_EXCLUSIVE</code>
016         */
017        public static final int TYPE_EXCLUSIVE = 1;
018    
019        /**
020         * locks a thread if already a other thread is come 
021         * until other thread notify him by unlock method
022         * @param type 
023         * @param name Lock Name (not case sensitive)
024         * @param timeout tiemout to for waiting in this method, if timeout occurs "lockTiemoutException" will be throwd
025         * @param pageContextId 
026         * @return  lock data object key for unlocking this lock
027         * @throws LockTimeoutException
028         * @throws InterruptedException
029         */
030        public abstract LockData lock(int type, String name, int timeout,
031                int pageContextId) throws LockTimeoutException,
032                InterruptedException;
033    
034        /**
035         * unlocks a locked thread in lock method
036         * @param data 
037         */
038        public abstract void unlock(LockData data);
039        
040        public String[] getOpenLockNames();
041        
042    
043            public void unlock(int pageContextId);
044    
045            // FUTURE add to interface public abstract void clean();
046    
047    }