public void lock()

in activeio-core/src/main/java/org/apache/activeio/journal/active/ControlFile.java [69:86]


    public void lock() throws IOException {

        Properties properties = System.getProperties();
        synchronized(properties) {
            String lockKey = "org.apache.activeio.journal.active.lockMap:"+canonicalPath;
            if( properties.setProperty(lockKey, "true")!=null ) {
                throw new JournalLockedException("Journal is already opened by this application.");
            }

            if( !brokenFileLock ) {
                lock = channel.tryLock();
                if (lock == null) {
                   properties.remove(lockKey);
                   throw new JournalLockedException("Journal is already opened by another application");
                }
            }
        }
    }