private void setLocker(File lock) { if (locker != null) return; String lockMode = configValues.getConfiguration(LocationHelper.PROP_OSGI_LOCKING, LocationHelper.LOCKING_NIO); locker = LocationHelper.createLocker(lock, lockMode, debug.get()); }
private void setLocker(File lock) { if (locker != null) return; String lockMode = environmentInfo.getConfiguration(LocationHelper.PROP_OSGI_LOCKING, LocationHelper.LOCKING_NIO); locker = LocationHelper.createLocker(lock, lockMode, debug); }
private void initializeInstanceFile() throws IOException { if (instanceFile != null || readOnly) return; this.instanceFile = File.createTempFile(".tmp", ".instance", managerRoot); //$NON-NLS-1$//$NON-NLS-2$ this.instanceFile.deleteOnExit(); instanceLocker = LocationHelper.createLocker(instanceFile, lockMode, false); instanceLocker.lock(); }
private void initializeInstanceFile() throws IOException { if (instanceFile != null || readOnly) return; this.instanceFile = File.createTempFile(".tmp", ".instance", managerRoot); //$NON-NLS-1$//$NON-NLS-2$ this.instanceFile.deleteOnExit(); instanceLocker = LocationHelper.createLocker(instanceFile, lockMode, false); instanceLocker.lock(); }
private void initializeInstanceFile() throws IOException { if (instanceFile != null || readOnly) return; this.instanceFile = File.createTempFile(".tmp", ".instance", managerRoot); //$NON-NLS-1$//$NON-NLS-2$ this.instanceFile.deleteOnExit(); instanceLocker = LocationHelper.createLocker(instanceFile, lockMode, false); instanceLocker.lock(); }
private void setLocker(File lock) { if (locker != null) return; String lockMode = environmentInfo.getConfiguration(LocationHelper.PROP_OSGI_LOCKING, LocationHelper.LOCKING_NIO); locker = LocationHelper.createLocker(lock, lockMode, debug); }
private void initializeInstanceFile() throws IOException { if (instanceFile != null || readOnly) return; this.instanceFile = File.createTempFile(".tmp", ".instance", managerRoot); //$NON-NLS-1$//$NON-NLS-2$ this.instanceFile.deleteOnExit(); instanceLocker = LocationHelper.createLocker(instanceFile, lockMode, false); instanceLocker.lock(); }
private void setLocker(File lock) { if (locker != null) return; String lockMode = configValues.getConfiguration(LocationHelper.PROP_OSGI_LOCKING, LocationHelper.LOCKING_NIO); locker = LocationHelper.createLocker(lock, lockMode, debug.get()); }
private void initializeInstanceFile() throws IOException { if (instanceFile != null || readOnly) return; this.instanceFile = File.createTempFile(".tmp", ".instance", managerRoot); //$NON-NLS-1$//$NON-NLS-2$ this.instanceFile.deleteOnExit(); instanceLocker = LocationHelper.createLocker(instanceFile, lockMode, false); instanceLocker.lock(); }
private void setLocker(File lock) { if (locker != null) return; String lockMode = configValues.getConfiguration(LocationHelper.PROP_OSGI_LOCKING, LocationHelper.LOCKING_NIO); locker = LocationHelper.createLocker(lock, lockMode, debug.get()); }
private void initializeInstanceFile() throws IOException { if (instanceFile != null || readOnly) return; this.instanceFile = File.createTempFile(".tmp", ".instance", managerRoot); //$NON-NLS-1$//$NON-NLS-2$ this.instanceFile.deleteOnExit(); instanceLocker = LocationHelper.createLocker(instanceFile, lockMode, false); instanceLocker.lock(); }
private void setLocker(File lock) { if (locker != null) return; String lockMode = configValues.getConfiguration(LocationHelper.PROP_OSGI_LOCKING, LocationHelper.LOCKING_NIO); locker = LocationHelper.createLocker(lock, lockMode, debug.get()); }
private boolean lock(boolean wait) throws IOException { if (readOnly) return false; if (locker == null) { locker = LocationHelper.createLocker(lockFile, lockMode, false); if (locker == null) throw new IOException(Msg.fileManager_cannotLock); } boolean locked = locker.lock(); if (locked || !wait) return locked; //Someone else must have the directory locked, but they should release it quickly long start = System.currentTimeMillis(); while (true) { try { Thread.sleep(200); // 5x per second } catch (InterruptedException e) {/*ignore*/ } locked = locker.lock(); if (locked) return true; // never wait longer than 5 seconds long time = System.currentTimeMillis() - start; if (time > MAX_LOCK_WAIT) return false; } }
private boolean lock(boolean wait) throws IOException { if (readOnly) return false; if (locker == null) { locker = LocationHelper.createLocker(lockFile, lockMode, false); if (locker == null) throw new IOException(Msg.fileManager_cannotLock); } boolean locked = locker.lock(); if (locked || !wait) return locked; //Someone else must have the directory locked, but they should release it quickly long start = System.currentTimeMillis(); while (true) { try { Thread.sleep(200); // 5x per second } catch (InterruptedException e) {/*ignore*/ } locked = locker.lock(); if (locked) return true; // never wait longer than 5 seconds long time = System.currentTimeMillis() - start; if (time > MAX_LOCK_WAIT) return false; } }
private boolean lock(boolean wait) throws IOException { if (readOnly) return false; if (locker == null) { locker = LocationHelper.createLocker(lockFile, lockMode, false); if (locker == null) throw new IOException(Msg.fileManager_cannotLock); } boolean locked = locker.lock(); if (locked || !wait) return locked; //Someone else must have the directory locked, but they should release it quickly long start = System.currentTimeMillis(); while (true) { try { Thread.sleep(200); // 5x per second } catch (InterruptedException e) {/*ignore*/ } locked = locker.lock(); if (locked) return true; // never wait longer than 5 seconds long time = System.currentTimeMillis() - start; if (time > MAX_LOCK_WAIT) return false; } }
private boolean lock(boolean wait) throws IOException { if (readOnly) return false; if (locker == null) { locker = LocationHelper.createLocker(lockFile, lockMode, false); if (locker == null) throw new IOException(Msg.fileManager_cannotLock); } boolean locked = locker.lock(); if (locked || !wait) return locked; //Someone else must have the directory locked, but they should release it quickly long start = System.currentTimeMillis(); while (true) { try { Thread.sleep(200); // 5x per second } catch (InterruptedException e) {/*ignore*/ } locked = locker.lock(); if (locked) return true; // never wait longer than 5 seconds long time = System.currentTimeMillis() - start; if (time > MAX_LOCK_WAIT) return false; } }
private boolean lock(boolean wait) throws IOException { if (readOnly) return false; if (locker == null) { locker = LocationHelper.createLocker(lockFile, lockMode, false); if (locker == null) throw new IOException(Msg.fileManager_cannotLock); } boolean locked = locker.lock(); if (locked || !wait) return locked; //Someone else must have the directory locked, but they should release it quickly long start = System.currentTimeMillis(); while (true) { try { Thread.sleep(200); // 5x per second } catch (InterruptedException e) {/*ignore*/ } locked = locker.lock(); if (locked) return true; // never wait longer than 5 seconds long time = System.currentTimeMillis() - start; if (time > MAX_LOCK_WAIT) return false; } }
private boolean lock(boolean wait) throws IOException { if (readOnly) return false; if (locker == null) { locker = LocationHelper.createLocker(lockFile, lockMode, false); if (locker == null) throw new IOException(Msg.fileManager_cannotLock); } boolean locked = locker.lock(); if (locked || !wait) return locked; //Someone else must have the directory locked, but they should release it quickly long start = System.currentTimeMillis(); while (true) { try { Thread.sleep(200); // 5x per second } catch (InterruptedException e) {/*ignore*/ } locked = locker.lock(); if (locked) return true; // never wait longer than 5 seconds long time = System.currentTimeMillis() - start; if (time > MAX_LOCK_WAIT) return false; } }
for (int i = 0; i < files.length; i++) { if (files[i].endsWith(".instance") && (instanceFile == null || !files[i].equalsIgnoreCase(instanceFile.getName()))) { //$NON-NLS-1$ Locker tmpLocker = LocationHelper.createLocker(new File(managerRoot, files[i]), lockMode, false); if (tmpLocker.lock()) {
for (int i = 0; i < files.length; i++) { if (files[i].endsWith(".instance") && (instanceFile == null || !files[i].equalsIgnoreCase(instanceFile.getName()))) { //$NON-NLS-1$ Locker tmpLocker = LocationHelper.createLocker(new File(managerRoot, files[i]), lockMode, false); if (tmpLocker.lock()) {