Package java.nio.channels

Examples of java.nio.channels.FileChannel.force()


                        synchronized(this) {
                            iosInProgress++;
                        }
                    }
                    if (!dataFactory.dataNotSyncedAtAllocation) {
                        ioChannel.force(false);
                    }
                } finally {
                    if (SanityManager.DEBUG) {
                        synchronized(this) {
                            iosInProgress--;
View Full Code Here


                bb.flip();
                ch.write( bb );
            }
   
            // Flush to the disk for real
            ch.force( true );
            ch.close();
        }
        catch ( KeyNotFoundException knfe )
        {
            knfe.printStackTrace();
View Full Code Here

                position += in.transferTo(position, 8192, out);
            }
        } finally {
            try {
                in.close();
                out.force(true);
                out.close();
            } catch (Exception e) {
                // ignore
            }
        }
View Full Code Here

            RandomAccessFile file = endOfLogSyncFile;
            if (file != null) {
           
                FileChannel channel = file.getChannel();
                try {
                    channel.force(false);
                } catch (ClosedChannelException e) {

                    /*
                     * The channel should never be closed. It may be closed
                     * because of an interrupt received by another thread. See
View Full Code Here

        ByteBuffer byteBuffer = channelBuffer.toByteBuffer();
        int written = 0;
        while (written < length) {
            written += fileChannel.write(byteBuffer);
        }
        fileChannel.force(false);
        fileChannel.close();
        outputStream.close();
        isRenamed = true;
        return written == length;
    }
View Full Code Here

        int written = 0;
        while (written < size) {
            written += localfileChannel.write(byteBuffer);
        }
        buffer.readerIndex(buffer.readerIndex() + written);
        localfileChannel.force(false);
        localfileChannel.close();
        outputStream.close();
        completed = true;
    }
View Full Code Here

        while (read > 0) {
            byteBuffer.position(read).flip();
            written += localfileChannel.write(byteBuffer);
            read = inputStream.read(bytes);
        }
        localfileChannel.force(false);
        localfileChannel.close();
        size = written;
        if (definedSize > 0 && definedSize < size) {
            file.delete();
            file = null;
View Full Code Here

      if (fsync) {
        FileChannel fc = os.getChannel();
        ByteBuffer buf = ByteBuffer.wrap(content);
        while (0 < buf.remaining())
          fc.write(buf);
        fc.force(true);
      } else {
        os.write(content);
      }
      os.close();
      os = null;
View Full Code Here

        if (wc.getFSyncRefFiles()) {
          FileChannel fc = out.getChannel();
          ByteBuffer buf = ByteBuffer.wrap(rec);
          while (0 < buf.remaining())
            fc.write(buf);
          fc.force(true);
        } else {
          out.write(rec);
        }
      } finally {
        out.close();
View Full Code Here

                        synchronized(this) {
                            iosInProgress++;
                        }
                    }
                    if (!dataFactory.dataNotSyncedAtAllocation) {
                        ioChannel.force(false);
                    }
                } finally {
                    if (SanityManager.DEBUG) {
                        synchronized(this) {
                            iosInProgress--;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.