Package org.h2.store

Examples of org.h2.store.FileLock.unlock()


        f.delete();
        f.createNewFile();
        f.setLastModified(System.currentTimeMillis() + 10000);
        FileLock lock = new FileLock(new TraceSystem(null), getFile(), Constants.LOCK_SLEEP);
        lock.lock(FileLock.LOCK_FILE);
        lock.unlock();
    }

    private void testSimple() {
        FileLock lock1 = new FileLock(new TraceSystem(null), getFile(), Constants.LOCK_SLEEP);
        FileLock lock2 = new FileLock(new TraceSystem(null), getFile(), Constants.LOCK_SLEEP);
View Full Code Here


        assertThrows(ErrorCode.DATABASE_ALREADY_OPEN_1, lock2).
                lock(FileLock.LOCK_FILE);
        lock1.unlock();
        lock2 = new FileLock(new TraceSystem(null), getFile(), Constants.LOCK_SLEEP);
        lock2.lock(FileLock.LOCK_FILE);
        lock2.unlock();
    }

    private void test(boolean allowSocketsLock) throws Exception {
        int threadCount = getSize(3, 5);
        wait = getSize(20, 200);
View Full Code Here

                    stop = true;
                }
                Thread.sleep(wait + (int) (Math.random() * wait));
                locks--;
                base.trace(lock + " unlock");
                lock.unlock();
                if (locks < 0) {
                    System.err.println("ERROR! LOCKS=" + locks);
                    stop = true;
                }
            } catch (Exception e) {
View Full Code Here

            } catch (InterruptedException e1) {
                // ignore
            }
        }
        if (lock != null) {
            lock.unlock();
        }
    }

}
View Full Code Here

            FileWriter fw = new FileWriter("error.txt", true);
            PrintWriter pw = new PrintWriter(fw);
            e.printStackTrace(pw);
            pw.close();
            fw.close();
            lock.unlock();
        } catch (Throwable t) {
            t.printStackTrace();
        }
        System.err.flush();
    }
View Full Code Here

        // locks is modified in the loop
        for (int i = 0; i < locks.size(); i++) {
            Table t = locks.get(i);
            if (!t.isLockedExclusively()) {
                synchronized (database) {
                    t.unlock(this);
                    locks.remove(i);
                }
                i--;
            }
        }
View Full Code Here

        if (locks.size() > 0) {
            synchronized (database) {
                // don't use the enhance for loop to safe memory
                for (int i = 0, size = locks.size(); i < size; i++) {
                    Table t = locks.get(i);
                    t.unlock(this);
                }
                locks.clear();
            }
        }
        savepoints = null;
View Full Code Here

        // locks is modified in the loop
        for (int i = 0; i < locks.size(); i++) {
            Table t = locks.get(i);
            if (!t.isLockedExclusively()) {
                synchronized (database) {
                    t.unlock(this);
                    locks.remove(i);
                }
                i--;
            }
        }
View Full Code Here

        if (locks.size() > 0) {
            synchronized (database) {
                // don't use the enhance for loop to safe memory
                for (int i = 0, size = locks.size(); i < size; i++) {
                    Table t = locks.get(i);
                    t.unlock(this);
                }
                locks.clear();
            }
        }
        savepoints = null;
View Full Code Here

        }
        for (int i = 0; i < locks.size(); i++) {
            Table t = locks.get(i);
            if (!t.isLockedExclusively()) {
                synchronized (database) {
                    t.unlock(this);
                    locks.remove(i);
                }
                i--;
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.