Skip to content

Commit

Permalink
Rename ProcedureGuard to TerminationGuard and move to procedure api p…
Browse files Browse the repository at this point in the history
…ackage
  • Loading branch information
boggle committed Sep 16, 2016
1 parent 48febaa commit 0d9512a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
Expand Up @@ -40,7 +40,7 @@
import org.neo4j.kernel.AvailabilityGuard;
import org.neo4j.kernel.DatabaseAvailability;
import org.neo4j.kernel.NeoStoreDataSource;
import org.neo4j.kernel.ProcedureGuard;
import org.neo4j.procedure.TerminationGuard;
import org.neo4j.kernel.api.KernelAPI;
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.api.Statement;
Expand Down Expand Up @@ -367,7 +367,7 @@ private Procedures setupProcedures( PlatformModule platform, EditionModule editi
// Register injected public API components
Log proceduresLog = platform.logging.getUserLog( Procedures.class );
procedures.registerComponent( Log.class, ( ctx ) -> proceduresLog );
procedures.registerComponent( ProcedureGuard.class, procedureGuard( platform.dependencies ) );
procedures.registerComponent( TerminationGuard.class, procedureGuard( platform.dependencies ) );

// Register injected private API components: useful to have available in procedures to access the kernel etc.
ProcedureGDSFactory gdsFactory = new ProcedureGDSFactory( platform.config, platform.storeDir,
Expand Down Expand Up @@ -402,13 +402,13 @@ private Procedures setupProcedures( PlatformModule platform, EditionModule editi
return procedures;
}

private ComponentRegistry.Provider<ProcedureGuard> procedureGuard( final Dependencies dependencies )
private ComponentRegistry.Provider<TerminationGuard> procedureGuard( final Dependencies dependencies )
{
Guard guard = dependencies.resolveDependency( Guard.class );
return (ctx) ->
{
KernelTransaction ktx = ctx.get( KERNEL_TRANSACTION );
return (ProcedureGuard) () ->
return (TerminationGuard) () ->
{
Status reason = ktx.getReasonIfTerminated();
if ( reason == null )
Expand Down
Expand Up @@ -17,14 +17,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel;
package org.neo4j.procedure;

/**
* ProcedureGuard allows a long running procedure to check at regular intervals if the surrounding executing
* TerminationGuard allows a long running procedure to check at regular intervals if the surrounding executing
* query has been terminated by the user or a database administrator or was timed out for some other reason.
*
*/
public interface ProcedureGuard
public interface TerminationGuard
{
/**
* Check that the surrounding executing query has not yet been terminated or timed out. Throws an appropriate
Expand Down
Expand Up @@ -46,7 +46,7 @@

import org.neo4j.graphdb.Result;
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.kernel.ProcedureGuard;
import org.neo4j.procedure.TerminationGuard;
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.enterprise.builtinprocs.QueryId;
import org.neo4j.kernel.impl.proc.Procedures;
Expand Down Expand Up @@ -972,7 +972,7 @@ protected ThreadingRule threading()
public static class NeverEndingProcedure {

@Context
public ProcedureGuard guard;
public TerminationGuard guard;

@Procedure(name = "test.loop")
public void loop()
Expand Down
Expand Up @@ -56,7 +56,6 @@
import org.neo4j.helpers.Exceptions;
import org.neo4j.helpers.collection.Iterators;
import org.neo4j.io.fs.FileUtils;
import org.neo4j.kernel.ProcedureGuard;
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.api.exceptions.Status;
import org.neo4j.kernel.api.security.AccessMode;
Expand Down Expand Up @@ -1221,7 +1220,7 @@ public static class ClassWithProcedures
public Log log;

@Context
public ProcedureGuard guard;
public TerminationGuard guard;

@Context
public KernelTransaction ktx;
Expand Down

0 comments on commit 0d9512a

Please sign in to comment.