src/share/classes/sun/nio/ch/FileChannelImpl.java
Print this page
*** 126,138 ****
ensureOpen();
if (!readable)
throw new NonReadableChannelException();
synchronized (positionLock) {
int n = 0;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return 0;
do {
n = IOUtil.read(fd, dst, -1, nd, positionLock);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
--- 126,139 ----
ensureOpen();
if (!readable)
throw new NonReadableChannelException();
synchronized (positionLock) {
int n = 0;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return 0;
do {
n = IOUtil.read(fd, dst, -1, nd, positionLock);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
*** 149,161 ****
ensureOpen();
if (!readable)
throw new NonReadableChannelException();
synchronized (positionLock) {
long n = 0;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return 0;
do {
n = IOUtil.read(fd, dsts, nd);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
--- 150,163 ----
ensureOpen();
if (!readable)
throw new NonReadableChannelException();
synchronized (positionLock) {
long n = 0;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return 0;
do {
n = IOUtil.read(fd, dsts, nd);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
*** 181,193 ****
ensureOpen();
if (!writable)
throw new NonWritableChannelException();
synchronized (positionLock) {
int n = 0;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return 0;
do {
n = IOUtil.write(fd, src, -1, nd, positionLock);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
--- 183,196 ----
ensureOpen();
if (!writable)
throw new NonWritableChannelException();
synchronized (positionLock) {
int n = 0;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return 0;
do {
n = IOUtil.write(fd, src, -1, nd, positionLock);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
*** 204,216 ****
ensureOpen();
if (!writable)
throw new NonWritableChannelException();
synchronized (positionLock) {
long n = 0;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return 0;
do {
n = IOUtil.write(fd, srcs, nd);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
--- 207,220 ----
ensureOpen();
if (!writable)
throw new NonWritableChannelException();
synchronized (positionLock) {
long n = 0;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return 0;
do {
n = IOUtil.write(fd, srcs, nd);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
*** 237,249 ****
public long position() throws IOException {
ensureOpen();
synchronized (positionLock) {
long p = -1;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return 0;
do {
p = position0(fd, -1);
} while ((p == IOStatus.INTERRUPTED) && isOpen());
--- 241,254 ----
public long position() throws IOException {
ensureOpen();
synchronized (positionLock) {
long p = -1;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return 0;
do {
p = position0(fd, -1);
} while ((p == IOStatus.INTERRUPTED) && isOpen());
*** 260,272 ****
ensureOpen();
if (newPosition < 0)
throw new IllegalArgumentException();
synchronized (positionLock) {
long p = -1;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return null;
do {
p = position0(fd, newPosition);
} while ((p == IOStatus.INTERRUPTED) && isOpen());
--- 265,278 ----
ensureOpen();
if (newPosition < 0)
throw new IllegalArgumentException();
synchronized (positionLock) {
long p = -1;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return null;
do {
p = position0(fd, newPosition);
} while ((p == IOStatus.INTERRUPTED) && isOpen());
*** 281,293 ****
public long size() throws IOException {
ensureOpen();
synchronized (positionLock) {
long s = -1;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return -1;
do {
s = nd.size(fd);
} while ((s == IOStatus.INTERRUPTED) && isOpen());
--- 287,300 ----
public long size() throws IOException {
ensureOpen();
synchronized (positionLock) {
long s = -1;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return -1;
do {
s = nd.size(fd);
} while ((s == IOStatus.INTERRUPTED) && isOpen());
*** 309,321 ****
if (!writable)
throw new NonWritableChannelException();
synchronized (positionLock) {
int rv = -1;
long p = -1;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return null;
// get current position
do {
--- 316,329 ----
if (!writable)
throw new NonWritableChannelException();
synchronized (positionLock) {
int rv = -1;
long p = -1;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return null;
// get current position
do {
*** 348,360 ****
}
public void force(boolean metaData) throws IOException {
ensureOpen();
int rv = -1;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return;
do {
rv = nd.force(fd, metaData);
} while ((rv == IOStatus.INTERRUPTED) && isOpen());
--- 356,369 ----
}
public void force(boolean metaData) throws IOException {
ensureOpen();
int rv = -1;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return;
do {
rv = nd.force(fd, metaData);
} while ((rv == IOStatus.INTERRUPTED) && isOpen());
*** 404,416 ****
int targetFDVal = IOUtil.fdVal(targetFD);
if (thisFDVal == targetFDVal) // Not supported on some configurations
return IOStatus.UNSUPPORTED;
long n = -1;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return -1;
do {
n = transferTo0(thisFDVal, position, icount, targetFDVal);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
--- 413,426 ----
int targetFDVal = IOUtil.fdVal(targetFD);
if (thisFDVal == targetFDVal) // Not supported on some configurations
return IOStatus.UNSUPPORTED;
long n = -1;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return -1;
do {
n = transferTo0(thisFDVal, position, icount, targetFDVal);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
*** 610,622 ****
throw new IllegalArgumentException("Negative position");
if (!readable)
throw new NonReadableChannelException();
ensureOpen();
int n = 0;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return -1;
do {
n = IOUtil.read(fd, dst, position, nd, positionLock);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
--- 620,633 ----
throw new IllegalArgumentException("Negative position");
if (!readable)
throw new NonReadableChannelException();
ensureOpen();
int n = 0;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return -1;
do {
n = IOUtil.read(fd, dst, position, nd, positionLock);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
*** 635,647 ****
throw new IllegalArgumentException("Negative position");
if (!writable)
throw new NonWritableChannelException();
ensureOpen();
int n = 0;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return -1;
do {
n = IOUtil.write(fd, src, position, nd, positionLock);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
--- 646,659 ----
throw new IllegalArgumentException("Negative position");
if (!writable)
throw new NonWritableChannelException();
ensureOpen();
int n = 0;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return -1;
do {
n = IOUtil.write(fd, src, position, nd, positionLock);
} while ((n == IOStatus.INTERRUPTED) && isOpen());
*** 729,741 ****
throw new NonWritableChannelException();
if (!readable)
throw new NonReadableChannelException();
long addr = -1;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return null;
if (size() < position + size) { // Extend file size
if (!writable) {
throw new IOException("Channel not open for writing " +
--- 741,754 ----
throw new NonWritableChannelException();
if (!readable)
throw new NonReadableChannelException();
long addr = -1;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return null;
if (size() < position + size) { // Extend file size
if (!writable) {
throw new IOException("Channel not open for writing " +
*** 898,910 ****
throw new NonWritableChannelException();
FileLockImpl fli = new FileLockImpl(this, position, size, shared);
FileLockTable flt = fileLockTable();
flt.add(fli);
boolean i = true;
! int ti = threads.add();
try {
begin();
if (!isOpen())
return null;
int result = nd.lock(fd, true, position, size, shared);
if (result == FileDispatcher.RET_EX_LOCK) {
assert shared;
--- 911,924 ----
throw new NonWritableChannelException();
FileLockImpl fli = new FileLockImpl(this, position, size, shared);
FileLockTable flt = fileLockTable();
flt.add(fli);
boolean i = true;
! int ti = -1;
try {
begin();
+ ti = threads.add();
if (!isOpen())
return null;
int result = nd.lock(fd, true, position, size, shared);
if (result == FileDispatcher.RET_EX_LOCK) {
assert shared;