Skip to content

Commit

Permalink
core-edge: remove return value from applier sync
Browse files Browse the repository at this point in the history
It was no longer used and always returned true.
  • Loading branch information
martinfurmanski committed May 25, 2016
1 parent e29f2b4 commit ae693be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
Expand Up @@ -96,7 +96,7 @@ public CoreState(
this.commitIndexMonitor = monitors.newMonitor( RaftLogCommitIndexMonitor.class, getClass() ); this.commitIndexMonitor = monitors.newMonitor( RaftLogCommitIndexMonitor.class, getClass() );
} }


public synchronized void setStateMachine( CoreStateMachines coreStateMachines, long lastApplied ) synchronized void setStateMachine( CoreStateMachines coreStateMachines, long lastApplied )
{ {
this.coreStateMachines = coreStateMachines; this.coreStateMachines = coreStateMachines;
this.lastApplied = this.lastFlushed = lastApplied; this.lastApplied = this.lastFlushed = lastApplied;
Expand Down Expand Up @@ -187,11 +187,7 @@ public void compact() throws IOException
*/ */
public synchronized void downloadSnapshot( AdvertisedSocketAddress source ) throws InterruptedException, StoreCopyFailedException public synchronized void downloadSnapshot( AdvertisedSocketAddress source ) throws InterruptedException, StoreCopyFailedException
{ {
if ( !applier.sync( true ) ) applier.sync( true );
{
throw new StoreCopyFailedException( "Failed to synchronize with executor" );
}

downloader.downloadSnapshot( source, this ); downloader.downloadSnapshot( source, this );
} }


Expand Down Expand Up @@ -238,10 +234,8 @@ public synchronized void start() throws IOException, RaftLogCompactedException,
@Override @Override
public synchronized void stop() throws Throwable public synchronized void stop() throws Throwable
{ {
if ( applier.sync( true ) ) applier.sync( true );
{ flush();
flush();
}
} }


public synchronized CoreSnapshot snapshot() throws IOException, RaftLogCompactedException public synchronized CoreSnapshot snapshot() throws IOException, RaftLogCompactedException
Expand All @@ -256,7 +250,7 @@ public synchronized CoreSnapshot snapshot() throws IOException, RaftLogCompacted
return coreSnapshot; return coreSnapshot;
} }


public synchronized void installSnapshot( CoreSnapshot coreSnapshot ) synchronized void installSnapshot( CoreSnapshot coreSnapshot )
{ {
coreStateMachines.installSnapshots( coreSnapshot ); coreStateMachines.installSnapshots( coreSnapshot );
sessionState = coreSnapshot.get( CoreStateType.SESSION_TRACKER ); sessionState = coreSnapshot.get( CoreStateType.SESSION_TRACKER );
Expand Down
Expand Up @@ -85,12 +85,9 @@ public void submit( Function<Status,Runnable> abortableTask )
* *
* @param cancelTasks Whether or not to flag for cancelling. * @param cancelTasks Whether or not to flag for cancelling.
* *
* @return Returns true if the executor managed to synchronize with the executor, meaning
* it successfully finished pending tasks. Otherwise false.
*
* @throws InterruptedException * @throws InterruptedException
*/ */
public boolean sync( boolean cancelTasks ) throws InterruptedException public void sync( boolean cancelTasks ) throws InterruptedException
{ {
if ( applier != null ) if ( applier != null )
{ {
Expand All @@ -108,6 +105,5 @@ public boolean sync( boolean cancelTasks ) throws InterruptedException
} }


spawnExecutor(); spawnExecutor();
return true;
} }
} }

0 comments on commit ae693be

Please sign in to comment.