We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public int read(ByteBuffer dst) throws IOException { checkNotNull(dst); checkOpen(); checkReadable();
int read = 0; // will definitely either be assigned or an exception will be thrown
// the synchronized can be deleted ??? synchronized (this) { boolean completed = false; try { if (!beginBlocking()) { return 0; // AsynchronousCloseException will be thrown } file.readLock().lockInterruptibly(); try { read = file.read(position, dst); if (read != -1) { position += read; } file.updateAccessTime(); completed = true; } finally { file.readLock().unlock(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } finally { endBlocking(completed); } }
return read;
}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
public int read(ByteBuffer dst) throws IOException {
checkNotNull(dst);
checkOpen();
checkReadable();
// the synchronized can be deleted ???
synchronized (this) {
boolean completed = false;
try {
if (!beginBlocking()) {
return 0; // AsynchronousCloseException will be thrown
}
file.readLock().lockInterruptibly();
try {
read = file.read(position, dst);
if (read != -1) {
position += read;
}
file.updateAccessTime();
completed = true;
} finally {
file.readLock().unlock();
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
endBlocking(completed);
}
}
}
The text was updated successfully, but these errors were encountered: