Skip to content

Commit

Permalink
Fix checkstyle and compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvest committed May 26, 2017
1 parent 86d527b commit 3b0b440
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 23 deletions.
Expand Up @@ -302,7 +302,7 @@ public void rewind()
} }


@Override @Override
public void close() throws IOException public void close()
{ {
if ( linkedCursor != null ) if ( linkedCursor != null )
{ {
Expand Down
Expand Up @@ -262,7 +262,7 @@ public abstract class PageCursor implements AutoCloseable
* @see AutoCloseable#close() * @see AutoCloseable#close()
*/ */
@Override @Override
public abstract void close() throws IOException; public abstract void close();


/** /**
* Returns true if the page has entered an inconsistent state since the last call to next() or shouldRetry(). * Returns true if the page has entered an inconsistent state since the last call to next() or shouldRetry().
Expand Down
Expand Up @@ -418,7 +418,7 @@ public boolean next( long pageId ) throws IOException
} }


@Override @Override
public void close() throws IOException public void close()
{ {
first.close(); first.close();
second.close(); second.close();
Expand Down
Expand Up @@ -117,7 +117,7 @@ public int getOffset()
} }


@Override @Override
public void close() throws IOException public void close()
{ {
delegate.close(); delegate.close();
} }
Expand Down
Expand Up @@ -123,7 +123,7 @@ public final boolean next( long pageId ) throws IOException
} }


@Override @Override
public final void close() throws IOException public final void close()
{ {
if ( pagedFile == null ) if ( pagedFile == null )
{ {
Expand Down Expand Up @@ -372,7 +372,7 @@ long assertPagedFileStillMappedAndGetIdOfLastPage()
return pagedFile.getLastPageId(); return pagedFile.getLastPageId();
} }


protected abstract void unpinCurrentPage() throws IOException; protected abstract void unpinCurrentPage();


protected abstract void convertPageFaultLock( long pageRef ); protected abstract void convertPageFaultLock( long pageRef );


Expand Down
Expand Up @@ -480,8 +480,9 @@ private void vectoredFlush(
} }
} }


void flushLockedPage( long pageRef, long filePageId ) throws IOException boolean flushLockedPage( long pageRef, long filePageId )
{ {
boolean success = false;
try ( MajorFlushEvent flushEvent = pageCacheTracer.beginFileFlush( swapper ) ) try ( MajorFlushEvent flushEvent = pageCacheTracer.beginFileFlush( swapper ) )
{ {
FlushEvent flush = flushEvent.flushEventOpportunity().beginFlush( filePageId, toId( pageRef ), swapper ); FlushEvent flush = flushEvent.flushEventOpportunity().beginFlush( filePageId, toId( pageRef ), swapper );
Expand All @@ -492,13 +493,14 @@ void flushLockedPage( long pageRef, long filePageId ) throws IOException
flush.addBytesWritten( bytesWritten ); flush.addBytesWritten( bytesWritten );
flush.addPagesFlushed( 1 ); flush.addPagesFlushed( 1 );
flush.done(); flush.done();
success = true;
} }
catch ( IOException e ) catch ( IOException e )
{ {
flush.done( e ); flush.done( e );
throw e;
} }
} }
return success;
} }


private void syncDevice() throws IOException private void syncDevice() throws IOException
Expand Down
Expand Up @@ -37,7 +37,7 @@ final class MuninnWritePageCursor extends MuninnPageCursor
} }


@Override @Override
protected void unpinCurrentPage() throws IOException protected void unpinCurrentPage()
{ {
if ( pinnedPageRef != 0 ) if ( pinnedPageRef != 0 )
{ {
Expand All @@ -56,16 +56,15 @@ protected void unpinCurrentPage() throws IOException
clearPageState(); clearPageState();
} }


private void eagerlyFlushAndUnlockPage() throws IOException private void eagerlyFlushAndUnlockPage()
{ {
long flushStamp = pagedFile.unlockWriteAndTryTakeFlushLock( pinnedPageRef ); long flushStamp = pagedFile.unlockWriteAndTryTakeFlushLock( pinnedPageRef );
if ( flushStamp != 0 ) if ( flushStamp != 0 )
{ {
boolean success = false; boolean success = false;
try try
{ {
pagedFile.flushLockedPage( pinnedPageRef, currentPageId ); success = pagedFile.flushLockedPage( pinnedPageRef, currentPageId );
success = true;
} }
finally finally
{ {
Expand Down
Expand Up @@ -172,7 +172,8 @@ public static boolean isExclusivelyLocked( long address )
*/ */
public static boolean tryWriteLock( long address ) public static boolean tryWriteLock( long address )
{ {
long s, n; long s;
long n;
for ( ; ; ) for ( ; ; )
{ {
s = getState( address ); s = getState( address );
Expand Down Expand Up @@ -214,7 +215,8 @@ private static void throwWriteLockOverflow( long s )
*/ */
public static void unlockWrite( long address ) public static void unlockWrite( long address )
{ {
long s, n; long s;
long n;
do do
{ {
s = getState( address ); s = getState( address );
Expand All @@ -239,7 +241,9 @@ private static long nextSeq( long s )


public static long unlockWriteAndTryTakeFlushLock( long address ) public static long unlockWriteAndTryTakeFlushLock( long address )
{ {
long s, n, r; long s;
long n;
long r;
do do
{ {
r = 0; r = 0;
Expand Down Expand Up @@ -367,7 +371,8 @@ public static long tryFlushLock( long address )
*/ */
public static void unlockFlush( long address, long stamp, boolean success ) public static void unlockFlush( long address, long stamp, boolean success )
{ {
long s, n; long s;
long n;
do do
{ {
s = getState( address ); s = getState( address );
Expand Down
Expand Up @@ -376,7 +376,7 @@ private void prepareNext()
} }


@Override @Override
public void close() throws IOException public void close()
{ {
delegate.close(); delegate.close();
linkedCursor = null; linkedCursor = null;
Expand Down
Expand Up @@ -245,7 +245,7 @@ public boolean next( long pageId ) throws IOException
} }


@Override @Override
public void close() throws IOException public void close()
{ {
delegate.close(); delegate.close();
linkedCursor = null; linkedCursor = null;
Expand Down
Expand Up @@ -123,7 +123,7 @@ public boolean next() throws IOException
} }


@Override @Override
public void close() throws IOException public void close()
{ {
assertNoReadWithoutShouldRetry(); assertNoReadWithoutShouldRetry();
super.close(); super.close();
Expand Down
Expand Up @@ -61,7 +61,7 @@ public PageCursor io( long pageId, int pf_flags ) throws IOException
return new DelegatingPageCursor( super.io( pageId, pf_flags ) ) return new DelegatingPageCursor( super.io( pageId, pf_flags ) )
{ {
@Override @Override
public void close() throws IOException public void close()
{ {
super.close(); super.close();
closeCounter.getAndIncrement(); closeCounter.getAndIncrement();
Expand Down
Expand Up @@ -74,7 +74,7 @@ public class PageListTest
private static final int[] pageIds = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; private static final int[] pageIds = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
private static final DummyPageSwapper DUMMY_SWAPPER = new DummyPageSwapper( "", UnsafeUtil.pageSize() ); private static final DummyPageSwapper DUMMY_SWAPPER = new DummyPageSwapper( "", UnsafeUtil.pageSize() );


@Parameterized.Parameters( name = "pageRef = {0}") @Parameterized.Parameters( name = "pageRef = {0}" )
public static Iterable<Object[]> parameters() public static Iterable<Object[]> parameters()
{ {
IntFunction<Object[]> toArray = x -> new Object[]{x}; IntFunction<Object[]> toArray = x -> new Object[]{x};
Expand Down Expand Up @@ -727,7 +727,9 @@ public void flushLockMustNotGetInterferenceFromAdjacentFlushLocks() throws Excep
pageList.unlockExclusive( prevPageRef ); pageList.unlockExclusive( prevPageRef );
pageList.unlockExclusive( pageRef ); pageList.unlockExclusive( pageRef );
pageList.unlockExclusive( nextPageRef ); pageList.unlockExclusive( nextPageRef );
long ps, ns, s; long ps;
long ns;
long s;
assertTrue( (ps = pageList.tryFlushLock( prevPageRef )) != 0 ); assertTrue( (ps = pageList.tryFlushLock( prevPageRef )) != 0 );
assertTrue( (ns = pageList.tryFlushLock( nextPageRef )) != 0 ); assertTrue( (ns = pageList.tryFlushLock( nextPageRef )) != 0 );
assertTrue( (s = pageList.tryFlushLock( pageRef )) != 0 ); assertTrue( (s = pageList.tryFlushLock( pageRef )) != 0 );
Expand Down Expand Up @@ -795,7 +797,8 @@ public void exclusiveLockMustNotGetInterferenceFromAdjacentFlushLocks() throws E
pageList.unlockExclusive( prevPageRef ); pageList.unlockExclusive( prevPageRef );
pageList.unlockExclusive( pageRef ); pageList.unlockExclusive( pageRef );
pageList.unlockExclusive( nextPageRef ); pageList.unlockExclusive( nextPageRef );
long ps, ns; long ps;
long ns;
assertTrue( (ps = pageList.tryFlushLock( prevPageRef )) != 0 ); assertTrue( (ps = pageList.tryFlushLock( prevPageRef )) != 0 );
assertTrue( (ns = pageList.tryFlushLock( nextPageRef )) != 0); assertTrue( (ns = pageList.tryFlushLock( nextPageRef )) != 0);
assertTrue( pageList.tryExclusiveLock( pageRef ) ); assertTrue( pageList.tryExclusiveLock( pageRef ) );
Expand Down

0 comments on commit 3b0b440

Please sign in to comment.