Skip to content

Commit

Permalink
Moves AvailabilityGuard#shutdown() call back to first thing in db shu…
Browse files Browse the repository at this point in the history
…tdown

Because it acts as a flag signalling to others that the db is shutting
down. This was otherwise a problem in some loops that would continue
until a database was shutting down.
  • Loading branch information
tinwelint authored and ragadeeshu committed Jun 14, 2017
1 parent 79c19d3 commit d9591bd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,5 @@ private void awaitTransactionsClosedWithinTimeout()
public void shutdown()
throws Throwable
{
availabilityGuard.shutdown();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.neo4j.collection.pool.LinkedQueuePool;
import org.neo4j.collection.pool.MarshlandPool;
import org.neo4j.function.Factory;
import org.neo4j.graphdb.DatabaseShutdownException;
import org.neo4j.graphdb.TransactionFailureException;
import org.neo4j.kernel.AvailabilityGuard;
import org.neo4j.kernel.api.KernelTransaction;
Expand Down Expand Up @@ -301,10 +300,6 @@ Set<KernelTransactionImplementation> getAllTransactions()

private void assertRunning()
{
if ( availabilityGuard.isShutdown() )
{
throw new DatabaseShutdownException();
}
if ( stopped )
{
throw new IllegalStateException( "Can't start new transaction with stopped " + getClass() );
Expand All @@ -322,7 +317,7 @@ private void assertCurrentThreadIsNotBlockingNewTransactions()

private class KernelTransactionImplementationFactory implements Factory<KernelTransactionImplementation>
{
private Set<KernelTransactionImplementation> transactions;
private final Set<KernelTransactionImplementation> transactions;

KernelTransactionImplementationFactory( Set<KernelTransactionImplementation> transactions )
{
Expand All @@ -345,7 +340,7 @@ public KernelTransactionImplementation newInstance()

private class GlobalKernelTransactionPool extends LinkedQueuePool<KernelTransactionImplementation>
{
private Set<KernelTransactionImplementation> transactions;
private final Set<KernelTransactionImplementation> transactions;

GlobalKernelTransactionPool( Set<KernelTransactionImplementation> transactions,
Factory<KernelTransactionImplementation> factory )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public void shutdown()
{
try
{
platform.availabilityGuard.shutdown();
msgLog.log( "Shutdown started" );
platform.life.shutdown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
import org.neo4j.storageengine.api.EntityType;

import static java.lang.String.format;

import static org.neo4j.collection.primitive.PrimitiveLongCollections.map;
import static org.neo4j.helpers.collection.Iterators.emptyIterator;
import static org.neo4j.kernel.api.security.SecurityContext.AUTH_DISABLED;
Expand Down

0 comments on commit d9591bd

Please sign in to comment.