Java 类java.io.SyncFailedException 实例源码

项目:incubator-netbeans    文件:FolderObj.java   
private void createFolder(final File folder2Create, final String name) throws IOException {
    boolean isSupported = new FileInfo(folder2Create).isSupportedFile();
    ProvidedExtensions extensions =  getProvidedExtensions();

    if (!isSupported) { 
        extensions.createFailure(this, folder2Create.getName(), true);
        FSException.io("EXC_CannotCreateFolder", folder2Create.getName(), getPath());// NOI18N   
    } else if (FileChangedManager.getInstance().exists(folder2Create)) {
        extensions.createFailure(this, folder2Create.getName(), true);            
        SyncFailedException sfe = new SyncFailedException(folder2Create.getAbsolutePath()); // NOI18N               
        String msg = NbBundle.getMessage(FileBasedFileSystem.class, "EXC_CannotCreateFolder", folder2Create.getName(), getPath()); // NOI18N
        Exceptions.attachLocalizedMessage(sfe, msg);
        throw sfe;
    } else if (!folder2Create.mkdirs()) {
        extensions.createFailure(this, folder2Create.getName(), true);
        FSException.io("EXC_CannotCreateFolder", folder2Create.getName(), getPath());// NOI18N               
    }
    LogRecord r = new LogRecord(Level.FINEST, "FolderCreated: "+ folder2Create.getAbsolutePath());
    r.setParameters(new Object[] {folder2Create});
    Logger.getLogger("org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj").log(r);
}
项目:incubator-netbeans    文件:FolderObj.java   
private void createData(final File file2Create) throws IOException {
    boolean isSupported = new FileInfo(file2Create).isSupportedFile();                        
    ProvidedExtensions extensions =  getProvidedExtensions();

    if (!isSupported) {             
        extensions.createFailure(this, file2Create.getName(), false);
        FSException.io("EXC_CannotCreateData", file2Create.getName(), getPath());// NOI18N
    } else if (FileChangedManager.getInstance().exists(file2Create)) {
        extensions.createFailure(this, file2Create.getName(), false);
        SyncFailedException sfe = new SyncFailedException(file2Create.getAbsolutePath()); // NOI18N               
        String msg = NbBundle.getMessage(FileBasedFileSystem.class, "EXC_CannotCreateData", file2Create.getName(), getPath()); // NOI18N
        Exceptions.attachLocalizedMessage(sfe, msg);
        throw sfe;
    } else if (!file2Create.createNewFile()) {
        extensions.createFailure(this, file2Create.getName(), false);            
        FSException.io("EXC_CannotCreateData", file2Create.getName(), getPath());// NOI18N
    }        
    LogRecord r = new LogRecord(Level.FINEST, "DataCreated: "+ file2Create.getAbsolutePath());
    r.setParameters(new Object[] {file2Create});
    Logger.getLogger("org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj").log(r);        
}
项目:runelite    文件:FileOnDisk.java   
@ObfuscatedName("k")
@ObfuscatedSignature(
   signature = "(ZI)V",
   garbageValue = "-1673795207"
)
@Export("closeSync")
public final void closeSync(boolean var1) throws IOException {
   if(this.file != null) {
      if(var1) {
         try {
            this.file.getFD().sync();
         } catch (SyncFailedException var3) {
            ;
         }
      }

      this.file.close();
      this.file = null;
   }

}
项目:TinyTravelTracker    文件:TimmyTable.java   
public void commitTransactionStage1() throws SyncFailedException, IOException
{
    //System.out.println("commitTransactionStage1: "+this);
    //stage 1
    //flush and sync everything
    insertRecordOut.flush();
    insertRecordFileOut.getFD().sync();
    insertRecordOut.close();

    rollForwardOut.flush();
    rollForwardFileOut.getFD().sync();
    rollForwardOut.close();

    //mark the roll back file as a real roll back file
    getRollForwardFile(true).renameTo(getRollForwardFile(false));
    //System.out.println("commitTransactionStage1 end: "+this);
}
项目:nyla    文件:WebLock.java   
/**
 * release the application lock
 * @param request the HTTP request
 * @param requestor the HTTP requestor
 * @return
 * @throws SyncFailedException
 * @throws SecurityException
 */
public synchronized static boolean releaseApplicationLock(HttpServletRequest request, Serializable requestor) 
throws SyncFailedException, SecurityException
{       

    if(request == null)
        return false;

    ServletContext application = Web.getApplication(request);

    //get previous
    Serializable previous = (Serializable)application.getAttribute(lockKey); 

    if(previous != null && previous.toString().length() > 0)
    {
        Debugger.printWarn(WebLock.class,"Lock was owner by "+previous+" but release by "+requestor);
    }

    application.setAttribute(lockKey, null);

    return true;
}
项目:In-the-Box-Fork    文件:SyncFailedExceptionTest.java   
/**
 * @tests java.io.SyncFailedException#SyncFailedException(java.lang.String)
 */
@TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "SyncFailedException",
        args = {java.lang.String.class}
    )
public void test_ConstructorLjava_lang_String() {
    try {
        if (true) // To avoid unreachable code compilation error.
            throw new SyncFailedException("Something went wrong.");
        fail("Test 1: SyncFailedException expected.");
    } catch (SyncFailedException e) {
        assertEquals("Test 2: Incorrect message;",
                "Something went wrong.", e.getMessage());
    }
}
项目:cn1    文件:SyncFailedExceptionTest.java   
/**
 * @tests java.io.SyncFailedException#SyncFailedException(java.lang.String)
 */
public void test_ConstructorLjava_lang_String() throws Exception {
    // Test for method java.io.SyncFailedException(java.lang.String)
               File f = null;
               try {
                   f = new File(System.getProperty("user.dir"), "synfail.tst");
                   FileOutputStream fos = new FileOutputStream(f.getPath());
                   FileDescriptor fd = fos.getFD();
                   fos.close();
                   fd.sync();
    } catch (SyncFailedException e) {
        f.delete();
        return;
    } 

    fail("Failed to generate expected Exception");
}
项目:bgzf4j    文件:BinaryCodec.java   
/**
 * Close the appropriate stream
 *
 * @throws IOException
 */
public void close() throws IOException {
    if (this.isWriting) {
        // To the degree possible, make sure the bytes get forced to the file system,
        // or else cause an exception to be thrown.
        if (this.outputStream instanceof FileOutputStream) {
            this.outputStream.flush();
            FileOutputStream fos = (FileOutputStream)this.outputStream;
            try {
                fos.getFD().sync();
            } catch (SyncFailedException e) {
                // Since the sync is belt-and-suspenders anyway, don't throw an exception if it
                // fails,
                // because on some OSs it will fail for some types of output. E.g. writing to
                // /dev/null
                // on some Unixes.
            }
        }
        this.outputStream.close();
    } else {
        this.inputStream.close();
    }
}
项目:freeVM    文件:SyncFailedExceptionTest.java   
/**
 * @tests java.io.SyncFailedException#SyncFailedException(java.lang.String)
 */
public void test_ConstructorLjava_lang_String() throws Exception {
    // Test for method java.io.SyncFailedException(java.lang.String)
               File f = null;
               try {
                   f = new File(System.getProperty("user.dir"), "synfail.tst");
                   FileOutputStream fos = new FileOutputStream(f.getPath());
                   FileDescriptor fd = fos.getFD();
                   fos.close();
                   fd.sync();
    } catch (SyncFailedException e) {
        f.delete();
        return;
    } 

    fail("Failed to generate expected Exception");
}
项目:ditb    文件:PreemptiveFastFailInterceptor.java   
/**
 * Check if the exception is something that indicates that we cannot
 * contact/communicate with the server.
 *
 * @param e
 * @return true when exception indicates that the client wasn't able to make contact with server
 */
private boolean isConnectionException(Throwable e) {
  if (e == null)
    return false;
  // This list covers most connectivity exceptions but not all.
  // For example, in SocketOutputStream a plain IOException is thrown
  // at times when the channel is closed.
  return (e instanceof SocketTimeoutException
      || e instanceof ConnectException || e instanceof ClosedChannelException
      || e instanceof SyncFailedException || e instanceof EOFException
      || e instanceof TimeoutException
      || e instanceof ConnectionClosingException || e instanceof FailedServerException);
}
项目:narrate-android    文件:DropboxSyncService.java   
@Override
public List<RemoteDataInfo> getRemoteEntries() throws SyncFailedException {
    StringBuilder sb = new StringBuilder();
    sb.append(getBaseFilePath());
    sb.append(ENTRIES);

    List<RemoteDataInfo> dataInfoObjects = new ArrayList<>();

    try {
        List<DropboxAPI.Entry> dropboxEntries = getFileInfo(sb.toString()).contents;

        for (DropboxAPI.Entry entry : dropboxEntries) {
            if ( !entry.isDir ) {
                RemoteDataInfo infoObject = new RemoteDataInfo();
                infoObject.isDirectory = entry.isDir;
                infoObject.isDeleted = entry.isDeleted;
                infoObject.name = entry.fileName().toUpperCase();
                infoObject.modifiedDate = RESTUtility.parseDate(entry.modified).getTime();
                infoObject.revision = entry.rev;
                dataInfoObjects.add(infoObject);
            }
        }

    } catch (Exception e) {
        if (!BuildConfig.DEBUG) Crashlytics.logException(e);
        e.printStackTrace();
        throw new SyncFailedException(e.getMessage());
    }

    return dataInfoObjects;
}
项目:narrate-android    文件:DropboxSyncService.java   
@Override
public List<RemoteDataInfo> getRemotePhotos() throws SyncFailedException {
    StringBuilder sb = new StringBuilder();
    sb.append(getBaseFilePath());
    sb.append(PHOTOS);

    List<RemoteDataInfo> dataInfoObjects = new ArrayList<>();

    try {
        List<DropboxAPI.Entry> dropboxEntries = getFileInfo(sb.toString()).contents;

        for (DropboxAPI.Entry file : dropboxEntries) {
            if ( !file.isDir ) {
                RemoteDataInfo infoObject = new RemoteDataInfo();
                infoObject.isDirectory = file.isDir;
                infoObject.isDeleted = file.isDeleted;
                infoObject.name = file.fileName().toLowerCase();
                infoObject.modifiedDate = RESTUtility.parseDate(file.modified).getTime();
                infoObject.revision = file.rev;
                dataInfoObjects.add(infoObject);
            }
        }

    } catch (Exception e) {
        if (!BuildConfig.DEBUG) Crashlytics.logException(e);
        e.printStackTrace();
        throw new SyncFailedException(e.getMessage());
    }

    return dataInfoObjects;
}
项目:narrate-android    文件:DriveSyncService.java   
@Override
public  List<RemoteDataInfo> getRemoteEntries() throws SyncFailedException {
    LogUtil.log(getClass().getSimpleName(), "Files in Narrate Drive AppFolder:");
    List<RemoteDataInfo> dataObjects = new ArrayList<>();

    try {
        List<File> contents = getContents();
        if (contents != null) {

            Iterator<File> iter = contents.iterator();
            File f;
            while (iter.hasNext()) {
                f = iter.next();
                LogUtil.log(getClass().getSimpleName(), f.getTitle());
                if (!f.getTitle().equals("photos")) {
                    RemoteDataInfo info = new RemoteDataInfo();
                    info.name = f.getTitle();
                    info.isDirectory = f.getMimeType().equals(FOLDER_MIME);
                    info.isDeleted = f.getLabels().getTrashed();
                    info.modifiedDate = f.getModifiedDate().getValue();
                    info.revision = String.valueOf(f.getVersion());
                    dataObjects.add(info);
                }
            }

            return dataObjects;
        }
    } catch (Exception e) {
        if (!BuildConfig.DEBUG) Crashlytics.logException(e);
        e.printStackTrace();
        throw new SyncFailedException(e.getMessage());
    }

    return null;
}
项目:narrate-android    文件:DriveSyncService.java   
@Override
public List<RemoteDataInfo> getRemotePhotos() throws SyncFailedException {
    LogUtil.log(DriveSyncService.class.getSimpleName(), "getRemotePhotos()");

    List<RemoteDataInfo> dataObjects = new ArrayList<>();
    try {
        List<File> result = getPhotosContents();

        LogUtil.log(getClass().getSimpleName(), "Files in Narrate Drive Photos Folder:");

        if (result.size() > 0) {
            for (File f : result) {
                LogUtil.log(getClass().getSimpleName(), f.getTitle());
                RemoteDataInfo info = new RemoteDataInfo();
                info.name = f.getTitle();
                info.isDirectory = f.getMimeType().equals(FOLDER_MIME);
                info.isDeleted = f.getLabels().getTrashed();
                info.modifiedDate = f.getModifiedDate().getValue();
                info.revision = String.valueOf(f.getVersion());
                dataObjects.add(info);
            }
        }
    } catch (Exception e) {
        if (!BuildConfig.DEBUG) Crashlytics.logException(e);
        e.printStackTrace();
        throw new SyncFailedException(e.getMessage());
    }

    return dataObjects;
}
项目:gemfirexd-oss    文件:LogAccessFile.java   
/**
 * Guarantee all writes up to the last call to flushLogAccessFile on disk.
 * <p>
 * A call for clients of LogAccessFile to insure that all data written
 * up to the last call to flushLogAccessFile() are written to disk.
 * This call will not return until those writes have hit disk.
 * <p>
 * Note that this routine may block waiting for I/O to complete so 
 * callers should limit the number of resource held locked while this
 * operation is called.  It is expected that the caller
 * Note that this routine only "writes" the data to the file, this does not
 * mean that the data has been synced to disk.  The only way to insure that
 * is to first call switchLogBuffer() and then follow by a call of sync().
 *
 **/
public void syncLogAccessFile() 
    throws IOException, StandardException
{
    for( int i=0; ; )
    {
        // 3311: JVM sync call sometimes fails under high load against NFS 
        // mounted disk.  We re-try to do this 20 times.
        try
        {
            synchronized( this)
            {
                log.sync( false);
            }

            // the sync succeed, so return
            break;
        }
        catch( SyncFailedException sfe )
        {
            i++;
            try
            {
                // wait for .2 of a second, hopefully I/O is done by now
                // we wait a max of 4 seconds before we give up
                Thread.sleep( 200 ); 
            }
            catch( InterruptedException ie )
            {   //does not matter weather I get interrupted or not
            }

            if( i > 20 )
                throw StandardException.newException(
                    SQLState.LOG_FULL, sfe);
        }
    }
}
项目:gemfirexd-oss    文件:DirRandomAccessFile4.java   
/**
 * 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;
    }
}
项目:VoltDB    文件:CSVTableSaveFile.java   
public static void convertTableSaveFile(char delimiter,
        Integer[] partitions, final File outfile, final File infile)
        throws FileNotFoundException, IOException, InterruptedException,
        SyncFailedException {
    final FileOutputStream fos = new FileOutputStream(outfile, true);
    try {
        final CSVTableSaveFile converter = new CSVTableSaveFile(infile,
                delimiter, partitions);
        try {
            while (true) {
                final byte bytes[] = converter.read();
                if (bytes.length == 0) {
                    break;
                }
                fos.write(bytes);
            }
        } finally {
            try {
                converter.close();
            } finally {
                fos.getFD().sync();
            }
        }
    } finally {
        fos.close();
    }
}
项目:gemfirexd-oss    文件:LogAccessFile.java   
/**
 * Guarantee all writes up to the last call to flushLogAccessFile on disk.
 * <p>
 * A call for clients of LogAccessFile to insure that all data written
 * up to the last call to flushLogAccessFile() are written to disk.
 * This call will not return until those writes have hit disk.
 * <p>
 * Note that this routine may block waiting for I/O to complete so 
 * callers should limit the number of resource held locked while this
 * operation is called.  It is expected that the caller
 * Note that this routine only "writes" the data to the file, this does not
 * mean that the data has been synced to disk.  The only way to insure that
 * is to first call switchLogBuffer() and then follow by a call of sync().
 *
 **/
public void syncLogAccessFile() 
    throws IOException, StandardException
{
    for( int i=0; ; )
    {
        // 3311: JVM sync call sometimes fails under high load against NFS 
        // mounted disk.  We re-try to do this 20 times.
        try
        {
            synchronized( this)
            {
                log.sync( false);
            }

            // the sync succeed, so return
            break;
        }
        catch( SyncFailedException sfe )
        {
            i++;
            try
            {
                // wait for .2 of a second, hopefully I/O is done by now
                // we wait a max of 4 seconds before we give up
                Thread.sleep( 200 ); 
            }
            catch( InterruptedException ie )
            {   //does not matter weather I get interrupted or not
            }

            if( i > 20 )
                throw StandardException.newException(
                    SQLState.LOG_FULL, sfe);
        }
    }
}
项目:gemfirexd-oss    文件:DirRandomAccessFile4.java   
/**
 * 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;
    }
}
项目:TinyTravelTracker    文件:GpsTrailerDbProvider.java   
public static TimmyDatabase createTimmyDb() throws SyncFailedException, IOException {
        TimmyDatabase timmyDb = new TimmyDatabase(GTG.getExternalStorageDirectory()+"/"+TIMMY_DB_FILENAME);
        timmyDb
        .addRollBackTimmyTable(
                GTG.getExternalStorageDirectory()+ "/"
                        + APCACHE_TIMMY_TABLE_FILENAME,
                GTG.crypt.crypt
                        .getNumOutputBytesForEncryption(AreaPanel.DATA_LENGTH));
        timmyDb
                .addRollBackTimmyTable(
                        GTG.getExternalStorageDirectory()+ "/"
                                + TIME_TREE_TIMMY_TABLE_FILENAME,
                                GTG.crypt.crypt
                                .getNumOutputBytesForEncryption(TimeTree.DATA_LENGTH));
        timmyDb
        .addTimmyTable(
                GTG.getExternalStorageDirectory()+ "/"
                        + MEDIA_LOC_TIME_TIMMY_TABLE_FILENAME,
                        GTG.crypt.crypt
                        .getNumOutputBytesForEncryption(MediaLocTime.DATA_LENGTH));
//      timmyDb
//      .addTimmyTable(
//              context.getExternalFilesDir(null) + "/"
//                      + MEDIA_LOC_TIME_PLUS_TIMMY_TABLE_FILENAME,
//              crypt.crypt
//                      .getNumOutputBytesForEncryption(MediaLocTime.DATA_LENGTH)
//                      + EncryptedRow.EXTRA_BYTES_FOR_USER_DATA_KEY);
        return timmyDb;
    }
项目:TinyTravelTracker    文件:PropertyTimmyTable.java   
public PropertyTimmyTable(String dbFilename, int nameSize,
        int valueSize, TimmyDatabase d) throws SyncFailedException, IOException {
    super(dbFilename, nameSize+valueSize, d);

    this.nameSize = nameSize;
    this.valueSize = valueSize;

    buf = new byte[super.getRecordSize()];
}
项目:TinyTravelTracker    文件:TimmyTable.java   
/**
 * Created by TimmmyDatabase
 */
protected TimmyTable(String filename, int recordSize, TimmyDatabase d)
        throws SyncFailedException, IOException {
    ////System.out.println("new: "+this);
    this.filename = filename;

    this.database = d;
    reopenRaf(recordSize);

    //System.out.println("new end: "+this);
}
项目:TinyTravelTracker    文件:TimmyTable.java   
private void createHeader(int recordSize) throws SyncFailedException,
        IOException {
    rwRaf.setLength(HEADER_SIZE);
    rwRaf.seek(0);
    rwRaf.write(MAGIC);
    rwRaf.write(VERSION);
    rwRaf.writeInt(0); // nextRowId;
    rwRaf.writeInt(recordSize);
    rwRaf.getFD().sync();

    this.recordSize = recordSize;
}
项目:TinyTravelTracker    文件:RollBackTimmyTable.java   
private void createHeader(int recordSize) throws SyncFailedException,
        IOException {
    rwRaf.setLength(HEADER_SIZE);
    rwRaf.seek(0);
    rwRaf.write(MAGIC);
    rwRaf.write(VERSION);
    rwRaf.writeInt(0); // nextRowId;
    rwRaf.writeInt(recordSize);
    rwRaf.getFD().sync();

    this.recordSize = recordSize;
}
项目:TinyTravelTracker    文件:RollBackTimmyTable.java   
/**
 * After this is called, all soft updates must be rerun as hard updates.
 * At that point the memory associated with update may be removed.
 * There may be no more inserts after this is called
 * @throws SyncFailedException
 * @throws IOException
 */
protected void softCommitTransaction() throws SyncFailedException, IOException
{
    //System.out.println("commitTransactionStage1: "+this);
    //stage 1
    //flush and sync rollback file      

    rollBackOut.flush();
    rollBackFileOut.getFD().sync();

    if(softModeSavedRows.size() != 0)
    {
        //record the actualy number of rows in this commit block (at the beginning of it)
        RandomAccessFile rbRaf = new RandomAccessFile(getRollBackFile(), "rws");
        rbRaf.seek(SOFT_COMMIT_NUM_ROWS_INDEX);
        rbRaf.writeInt(softModeSavedRows.size());
        rbRaf.getFD().sync();
        rbRaf.close();
    }

    rollBackOut.close();

    rollBackOut = null; rollBackFileOut = null;

    hardWriteMode = true;

}
项目:TinyTravelTracker    文件:TimmyDatabase.java   
/**
 * This or addRollBackTimmyTable must be called for all tables in database before open()
 * @param filename
 * @param recordSize
 * @return
 * @throws SyncFailedException
 * @throws IOException
 */
public TimmyTable addTimmyTable(String filename, int recordSize)
throws SyncFailedException, IOException {
    if(isOpen)
        throw new IllegalStateException("table can't be added after database is open");

    TimmyTable tt = new TimmyTable(filename, recordSize, this);

    tables.add(tt);

    return tt;
}
项目:TinyTravelTracker    文件:TimmyDatabase.java   
public RollBackTimmyTable addRollBackTimmyTable(String filename, int recordSize)
throws SyncFailedException, IOException {
    if(isOpen)
        throw new IllegalStateException("table can't be added after database is open");

    RollBackTimmyTable tt = new RollBackTimmyTable(filename, recordSize, this);

    tables.add(tt);

    return tt;
}
项目:pbase    文件:PreemptiveFastFailInterceptor.java   
/**
 * Check if the exception is something that indicates that we cannot
 * contact/communicate with the server.
 *
 * @param e
 * @return true when exception indicates that the client wasn't able to make contact with server
 */
private boolean isConnectionException(Throwable e) {
  if (e == null)
    return false;
  // This list covers most connectivity exceptions but not all.
  // For example, in SocketOutputStream a plain IOException is thrown
  // at times when the channel is closed.
  return (e instanceof SocketTimeoutException
      || e instanceof ConnectException || e instanceof ClosedChannelException
      || e instanceof SyncFailedException || e instanceof EOFException
      || e instanceof TimeoutException
      || e instanceof ConnectionClosingException || e instanceof FailedServerException);
}
项目:libelula    文件:HDStore.java   
private void persistPlayersTable() throws IOException {
    if (playersTable != null && playerIDs != null) {
        if (debug) {
            plugin.getLogger().info("DEBUG: Saving players to ".concat(playersTable.getAbsolutePath()));
        }
        try (ObjectOutputStream oos = new ObjectOutputStream(
                new FileOutputStream(playersTable.getCanonicalPath(), false))) {
            oos.writeObject(playerIDs);
            oos.close();
        }
    } else {
        throw new SyncFailedException("Unable to persist player database.");
    }
}
项目:minha    文件:FileDescriptor.java   
public void sync() throws SyncFailedException {
    try {
        SimulationThread.stopTime(0);
        if (st == null)
            return;
        SimulationThread current = SimulationThread.currentSimulationThread();
        long syncDelay = st.getSyncTarget() - current.getTimeline().getTime();
        if (syncDelay > 0)
            if (current.idle(syncDelay, false, false))
                throw new SyncFailedException("thread interrupted");
    } finally {
        SimulationThread.startTime(0);
    }
}
项目:hbase    文件:ClientExceptionsUtil.java   
/**
 * Check if the exception is something that indicates that we cannot
 * contact/communicate with the server.
 *
 * @param e exception to check
 * @return true when exception indicates that the client wasn't able to make contact with server
 */
public static boolean isConnectionException(Throwable e) {
  if (e == null) {
    return false;
  }
  // This list covers most connectivity exceptions but not all.
  // For example, in SocketOutputStream a plain IOException is thrown
  // at times when the channel is closed.
  return (e instanceof SocketTimeoutException || e instanceof ConnectException
    || e instanceof ClosedChannelException || e instanceof SyncFailedException
    || e instanceof EOFException || e instanceof TimeoutException
    || e instanceof CallTimeoutException || e instanceof ConnectionClosingException
    || e instanceof FailedServerException);
}
项目:TinyTravelTracker    文件:RollBackTimmyTable.java   
@Override
public void commitTransactionStage1() throws SyncFailedException,
        IOException {
    //noop, softCommit should already be run at this point
}
项目:wildfly-core    文件:PatchLogger.java   
@Message(id = 18, value = "copied content does not match expected hash for item: %s")
SyncFailedException wrongCopiedContent(ContentItem item);
项目:sparkey-java    文件:SnappyOutputStream.java   
public void fsync() throws SyncFailedException {
  fileDescriptor.sync();
}
项目:monarch    文件:OverflowOplog.java   
/**
 * Test Method to be used only for testing purposes. Gets the underlying File object for the Oplog
 * . Oplog class uses this File object to obtain the RandomAccessFile object. Before returning the
 * File object , the dat present in the buffers of the RandomAccessFile object is flushed.
 * Otherwise, for windows the actual file length does not match with the File size obtained from
 * the File object
 * 
 * @throws IOException
 * @throws SyncFailedException
 */
File getOplogFile() throws SyncFailedException, IOException {
  synchronized (this.crf) {
    if (!this.crf.RAFClosed) {
      this.crf.raf.getFD().sync();
    }
    return this.crf.f;
  }
}
项目:gemfirexd-oss    文件:OverflowOplog.java   
/**
 * Test Method to be used only for testing purposes. Gets the underlying File
 * object for the Oplog . Oplog class uses this File object to obtain the
 * RandomAccessFile object. Before returning the File object , the dat present
 * in the buffers of the RandomAccessFile object is flushed. Otherwise, for
 * windows the actual file length does not match with the File size obtained
 * from the File object
 * 
 * @throws IOException
 * @throws SyncFailedException
 */
File getOplogFile() throws SyncFailedException, IOException
{
  synchronized (this.crf) {
    if (!this.crf.RAFClosed) {
      this.crf.raf.getFD().sync();
    }
    return this.crf.f;
  }
}
项目:gemfirexd-oss    文件:Oplog.java   
/**
 * Test Method to be used only for testing purposes. Gets the underlying File
 * object for the Oplog . Oplog class uses this File object to obtain the
 * RandomAccessFile object. Before returning the File object , the dat present
 * in the buffers of the RandomAccessFile object is flushed. Otherwise, for
 * windows the actual file length does not match with the File size obtained
 * from the File object
 * 
 * @throws IOException
 * @throws SyncFailedException
 */
File getOplogFile() throws SyncFailedException, IOException
{
  // @todo check callers for drf
  synchronized (this.lock/*crf*/) {
    if (!this.crf.RAFClosed) {
      this.crf.raf.getFD().sync();
    }
    return this.crf.f;
  }
}
项目:gemfirexd-oss    文件:OverflowOplog.java   
/**
 * Test Method to be used only for testing purposes. Gets the underlying File
 * object for the Oplog . Oplog class uses this File object to obtain the
 * RandomAccessFile object. Before returning the File object , the dat present
 * in the buffers of the RandomAccessFile object is flushed. Otherwise, for
 * windows the actual file length does not match with the File size obtained
 * from the File object
 * 
 * @throws IOException
 * @throws SyncFailedException
 */
File getOplogFile() throws SyncFailedException, IOException
{
  synchronized (this.crf) {
    if (!this.crf.RAFClosed) {
      this.crf.raf.getFD().sync();
    }
    return this.crf.f;
  }
}
项目:gemfirexd-oss    文件:Oplog.java   
/**
 * Test Method to be used only for testing purposes. Gets the underlying File
 * object for the Oplog . Oplog class uses this File object to obtain the
 * RandomAccessFile object. Before returning the File object , the dat present
 * in the buffers of the RandomAccessFile object is flushed. Otherwise, for
 * windows the actual file length does not match with the File size obtained
 * from the File object
 * 
 * @throws IOException
 * @throws SyncFailedException
 */
File getOplogFile() throws SyncFailedException, IOException
{
  // @todo check callers for drf
  synchronized (this.lock/*crf*/) {
    if (!this.crf.RAFClosed) {
      this.crf.raf.getFD().sync();
    }
    return this.crf.f;
  }
}
项目:TinyTravelTracker    文件:RollBackTimmyTable.java   
/**
 * Created by TimmmyDatabase
 */
protected RollBackTimmyTable(String filename, int recordSize, TimmyDatabase d)
        throws SyncFailedException, IOException {
    this.filename = filename;

    this.database = d;
    reopenRaf(recordSize);

    tempRecordData = new byte[recordSize];

    //System.out.println("new end: "+this);

}