private synchronized FileLock access(boolean shared, String mode, int timeOut) throws IOException, TimeoutException { raf = new RandomAccessFile(file, mode); fc = raf.getChannel(); final FileLock fl = get(fc, shared); if (maxHoldingTime != -1) { timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { try { if (fl.isValid()) { logger.severe(localStrings.getLocalString("FileLockNotReleased", "File Lock not released on {0}", file.getPath())); release(fl); } } catch (IOException e) { e.printStackTrace(); } } }, timeOut); } return fl; }
private synchronized FileLock access(boolean shared, String mode, int timeOut) throws IOException, TimeoutException { raf = new RandomAccessFile(file, mode); fc = raf.getChannel(); final FileLock fl = get(fc, shared); if (maxHoldingTime != -1) { timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { try { if (fl.isValid()) { logger.log(Level.SEVERE, CULoggerInfo.fileLockNotReleased, file.getPath()); release(fl); } } catch (IOException e) { e.printStackTrace(); } } }, timeOut); } return fl; }
private synchronized FileLock access(boolean shared, String mode, int timeOut) throws IOException, TimeoutException { raf = new RandomAccessFile(file, mode); fc = raf.getChannel(); final FileLock fl = get(fc, shared); if (maxHoldingTime != -1) { timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { try { if (fl.isValid()) { logger.log(Level.SEVERE, CULoggerInfo.fileLockNotReleased, file.getPath()); release(fl); } } catch (IOException e) { e.printStackTrace(); } } }, timeOut); } return fl; }