/** * Ensures that data which is buffered within the underlying implementation * is written out to the appropriate device before returning. */ public void sync() throws SyncFailedException { try { if (Libcore.os.isatty(this)) { Libcore.os.tcdrain(this); } else { Libcore.os.fsync(this); } } catch (ErrnoException errnoException) { SyncFailedException sfe = new SyncFailedException(errnoException.getMessage()); sfe.initCause(errnoException); throw sfe; } }
protected void createData(String name) throws IOException { File f = getFile(name); boolean isError = true; IOException creationException = null; String annotationMsg = null; try { isError = f.createNewFile() ? false : true; isError = isError ? true : (!f.exists()); if (isError) { annotationMsg = NbBundle.getMessage(LocalFileSystem.class, "EXC_DataAlreadyExist", f.getName(), getDisplayName(), f.getAbsolutePath()); creationException = new SyncFailedException(annotationMsg); } } catch (IOException iex) { isError = true; creationException = iex; annotationMsg = iex.getLocalizedMessage(); } if (isError) { LOG.log(Level.INFO, "Trying to create new file {0}.", f.getPath()); ExternalUtil.annotate(creationException, annotationMsg); throw creationException; } }
@Override public final SyncFailedException wrongCopiedContent(final ContentItem item) { final SyncFailedException result = new SyncFailedException(String.format(getLoggingLocale(), wrongCopiedContent$str(), item)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String illegalPatchName = "WFLYPAT0019: invalid patch name '%s'";
/** * Will hint the OS that this is will not be accessed again and should hence be dropped from the buffer cache. * @param fd The file descriptor to drop from buffer cache. */ public void dropFileFromCache(FileDescriptor fd) { try { fd.sync(); } catch (SyncFailedException e) { logger.warning("Sync failed while dropping cache: " + e.getMessage()); } if (initialized) { posix_fadvise(getNativeFD(fd), 0, 0, POSIX_FADV_DONTNEED); } }
@Substitute public /* native */ void sync() throws SyncFailedException { // 55 FD fd = THIS_FD(this); // 56 if (IO_Sync(fd) == -1) { if (Unistd.fsync(fd) == -1) { // 57 JNU_ThrowByName(env, "java/io/SyncFailedException", "sync failed"); throw new SyncFailedException("sync failed"); } }
@Override public final SyncFailedException wrongCopiedContent(final ContentItem item) { final SyncFailedException result = new SyncFailedException(String.format(getLoggingLocale(), wrongCopiedContent$str(), item)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String illegalPatchName = "WFLYPAT0019: invalid patch name '%s'";
os.getFD().sync(); } catch (SyncFailedException e2) { Utils.log(e2.getMessage()); } catch (IOException e2) { Utils.log(e2.getMessage());
/** * Force any changes out to the persistent store. * * @param metaData If true then this method is required to force changes to both the file's * content and metadata to be written to storage; otherwise, it need only force content changes * to be written. * * @exception IOException If an IO error occurs. */ public void sync( boolean metaData) throws IOException { try { getChannel().force( metaData); } catch( ClosedChannelException cce) { throw cce;} catch( IOException ioe) { SyncFailedException sne = new SyncFailedException( ioe.getMessage()); sne.initCause( ioe); throw sne; } } // end of sync }
throw new SyncFailedException("Closed " + closed + " valid " + fd.valid() + " useCount " + useCount);
/** * Force any changes out to the persistent store. * * @param metaData If true then this method is required to force changes to both the file's * content and metadata to be written to storage; otherwise, it need only force content changes * to be written. * * @exception IOException If an IO error occurs. */ public void sync( boolean metaData) throws IOException { try { getChannel().force( metaData); } catch( ClosedChannelException cce) { throw cce;} catch( IOException ioe) { SyncFailedException sne = new SyncFailedException( ioe.getMessage()); sne.initCause( ioe); throw sne; } } // end of sync }
protected void createData (String name) throws IOException { File f = getFile (name); boolean isError = true; IOException creationException = null; String annotationMsg = null; try { isError = f.createNewFile () ? false : true; isError = isError ? true : !f.exists(); if (isError) { Object[] msgParams; msgParams = new Object[] { f.getName(), getDisplayName(), f.getAbsolutePath()}; annotationMsg = NbBundle.getMessage(LocalFileSystem.class,"EXC_DataAlreadyExist", msgParams);//NOI18N creationException = new SyncFailedException(annotationMsg); } } catch (IOException iex) { isError = true; creationException = iex; annotationMsg = iex.getLocalizedMessage(); } if (isError) { ExternalUtil.annotate (creationException, annotationMsg); throw creationException; } }
/** * Force any changes out to the persistent store. * * @param metaData If true then this method is required to force changes to both the file's * content and metadata to be written to storage; otherwise, it need only force content changes * to be written. * * @exception IOException If an IO error occurs. */ public void sync( boolean metaData) throws IOException { try { getChannel().force( metaData); } catch( ClosedChannelException cce) { throw cce;} catch( IOException ioe) { SyncFailedException sne = new SyncFailedException( ioe.getMessage()); sne.initCause( ioe); throw sne; } } // end of sync }
protected void createData (String name) throws IOException { File f = getFile (name); boolean isError = true; IOException creationException = null; String annotationMsg = null; try { isError = f.createNewFile () ? false : true; isError = isError ? true : !f.exists(); if (isError) { Object[] msgParams; msgParams = new Object[] { f.getName(), getDisplayName(), f.getAbsolutePath()}; annotationMsg = NbBundle.getMessage(LocalFileSystem.class,"EXC_DataAlreadyExist", msgParams);//NOI18N creationException = new SyncFailedException(annotationMsg); } } catch (IOException iex) { isError = true; creationException = iex; annotationMsg = iex.getLocalizedMessage(); } if (isError) { ExternalUtil.annotate (creationException, annotationMsg); throw creationException; } }
/** * Ensures that data which is buffered within the underlying implementation * is written out to the appropriate device before returning. */ public void sync() throws SyncFailedException { try { if (Libcore.os.isatty(this)) { Libcore.os.tcdrain(this); } else { Libcore.os.fsync(this); } } catch (ErrnoException errnoException) { SyncFailedException sfe = new SyncFailedException(errnoException.getMessage()); sfe.initCause(errnoException); throw sfe; } }
throw new SyncFailedException("Closed " + closed + " valid " + fd.valid() + " useCount " + useCount);
/** * Ensures that data which is buffered within the underlying implementation * is written out to the appropriate device before returning. */ public void sync() throws SyncFailedException { try { if (Libcore.os.isatty(this)) { Libcore.os.tcdrain(this); } else { Libcore.os.fsync(this); } } catch (ErrnoException errnoException) { SyncFailedException sfe = new SyncFailedException(errnoException.getMessage()); sfe.initCause(errnoException); throw sfe; } }
throw new SyncFailedException("Closed " + closed + " valid " + fd.valid() + " useCount " + useCount);
/** * Ensures that data which is buffered within the underlying implementation * is written out to the appropriate device before returning. */ public void sync() throws SyncFailedException { try { if (Libcore.os.isatty(this)) { Libcore.os.tcdrain(this); } else { Libcore.os.fsync(this); } } catch (ErrnoException errnoException) { SyncFailedException sfe = new SyncFailedException(errnoException.getMessage()); sfe.initCause(errnoException); throw sfe; } }
throw new SyncFailedException("Closed " + closed + " valid " + fd.valid() + " useCount " + useCount);
/** * Ensures that data which is buffered within the underlying implementation * is written out to the appropriate device before returning. */ public void sync() throws SyncFailedException { try { if (Libcore.os.isatty(this)) { Libcore.os.tcdrain(this); } else { Libcore.os.fsync(this); } } catch (ErrnoException errnoException) { SyncFailedException sfe = new SyncFailedException(errnoException.getMessage()); sfe.initCause(errnoException); throw sfe; } }