Buggy code:
class RAFContainer extends FileContainer implements PrivilegedExceptionAction { protected StorageRandomAccessFile fileData ; protected boolean needsSync ; private int actionCode ; private static final int GET_FILE_NAME_ACTION = 1 ; private static final int CREATE_CONTAINER_ACTION = 2 ; private static final int REMOVE_FILE_ACTION = 3 ; private static final int OPEN_CONTAINER_ACTION = 4 ; private static final int STUBBIFY_ACTION = 5 ; private static final int BACKUP_CONTAINER_ACTION = 6 ; private static final int GET_RANDOM_ACCESS_FILE_ACTION = 7 ; private ContainerKey actionIdentity ; protected ContainerKey currentIdentity ; private boolean reopen ; private boolean actionStub ; private boolean actionErrorOK ; private boolean actionTryAlternatePath ; private StorageFile actionFile ; private LogInstant actionInstant ; private String actionBackupLocation ; private BaseContainerHandle actionContainerHandle ; private boolean inBackup = false ; private boolean inRemove = false ; private String fileName ; RAFContainer ( BaseDataFileFactory factory ) { } public synchronized boolean isDirty ( ) { } public Cacheable setIdentity ( Object key ) throws StandardException { } public Cacheable createIdentity ( Object key , Object createParameter ) throws StandardException { } protected void removeContainer ( LogInstant instant , boolean leaveStub ) throws StandardException { } void closeContainer ( ) { } protected void readPage ( long pageNumber , byte [ ] pageData ) throws IOException , StandardException { } protected void writePage ( long pageNumber , byte [ ] pageData , boolean syncPage ) throws IOException , StandardException { } protected byte [ ] updatePageArray ( long pageNumber , byte [ ] pageData , byte [ ] encryptionBuf , boolean encryptWithNewEngine ) throws IOException , StandardException { } private boolean padFile ( StorageRandomAccessFile file , long pageOffset ) throws IOException , StandardException { } public void clean ( boolean forRemove ) throws StandardException { boolean waited = false ; boolean success = false ; int maxTries = MAX_INTERRUPT_RETRIES ; while ( ! success ) { success = true ; synchronized ( this ) { if ( getCommittedDropState ( ) ) { clearDirty ( ) ; return ; } while ( ( preDirty ) == true ) { waited = true ; try { wait ( ) ; } catch ( InterruptedException ie ) { InterruptStatus . setInterrupted ( ) ; } } if ( waited ) { if ( getCommittedDropState ( ) ) { clearDirty ( ) ; return ; } } if ( forRemove ) { } else if ( isDirty ( ) ) { try { writeRAFHeader ( getIdentity ( ) , fileData , false , true ) ; clearDirty ( ) ; } catch ( InterruptDetectedException e ) { if ( ( -- maxTries ) > 0 ) { success = false ; try { <START_BUG> Thread . sleep ( 500 ) ; <END_BUG> } catch ( InterruptedException ee ) { InterruptStatus . setInterrupted ( ) ; } continue ; } else { throw StandardException . newException ( FILE_IO_INTERRUPTED , e ) ; } } catch ( IOException ioe ) { throw dataFactory . markCorrupt ( StandardException . newException ( FILE_CONTAINER_EXCEPTION , ioe , ( ( getIdentity ( ) ) != null ? getIdentity ( ) . toString ( ) : "unknown" ) , "clean" , fileName ) ) ; } } } } } private void clearDirty ( ) { } protected int preAllocate ( long lastPreallocPagenum , int preAllocSize ) { } protected void truncatePages ( long lastValidPagenum ) throws StandardException { } private void writeRAFHeader ( Object identity , StorageRandomAccessFile file , boolean create , boolean syncFile ) throws IOException , StandardException { } protected void flushAll ( ) throws StandardException { } synchronized StorageFile getFileName ( ContainerKey identity , boolean stub , boolean errorOK , boolean tryAlternatePath ) throws StandardException { } protected StorageFile privGetFileName ( ContainerKey identity , boolean stub , boolean errorOK , boolean tryAlternatePath ) throws StandardException { } synchronized void createContainer ( ContainerKey newIdentity ) throws StandardException { } synchronized boolean removeFile ( StorageFile file ) throws SecurityException , StandardException { } private boolean privRemoveFile ( StorageFile file ) throws StandardException { } protected ContainerKey idAPriori = null ; synchronized boolean openContainer ( ContainerKey newIdentity ) throws StandardException { } synchronized boolean reopenContainer ( ContainerKey newIdentity ) throws StandardException { } private boolean openContainerMinion ( ContainerKey newIdentity , boolean doReopen ) throws StandardException { } private synchronized void stubbify ( LogInstant instant ) throws StandardException { } protected void backupContainer ( BaseContainerHandle handle , String backupLocation ) throws StandardException { } private void privBackupContainer ( BaseContainerHandle handle , String backupLocation ) throws StandardException { } protected void encryptContainer ( BaseContainerHandle handle , String newFilePath ) throws StandardException { } synchronized StorageRandomAccessFile privGetRandomAccessFile ( StorageFile file ) throws SecurityException , StandardException { } public Object run ( ) throws IOException , StandardException { } }

Fix:
Thread . sleep ( INTERRUPT_RETRY_SLEEP ) ;