This is an automated email from the ASF dual-hosted git repository. andy pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/jena.git
commit cc8888ab72048b37b82e646f293acb001cd2f141 Author: Andy Seaborne <a...@apache.org> AuthorDate: Sun Aug 4 14:00:49 2024 +0100 Tidy comments --- .../apache/jena/sparql/engine/ExecutionContext.java | 3 ++- .../apache/jena/sparql/engine/binding/Binding.java | 2 +- .../jena/sparql/engine/iterator/QueryIter.java | 3 ++- .../sparql/engine/iterator/QueryIteratorBase.java | 20 ++++++++++++-------- .../sparql/engine/iterator/QueryIteratorCheck.java | 1 - .../sparql/engine/iterator/QueryIteratorWrapper.java | 1 - .../apache/jena/base/module/SubsystemLifecycle.java | 20 +++++++++++++------- .../org/apache/jena/base/module/package-info.java | 1 - 8 files changed, 30 insertions(+), 21 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ExecutionContext.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ExecutionContext.java index 87329d4ef7..8d67401a3c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ExecutionContext.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ExecutionContext.java @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.jena.atlas.iterator.Iter; import org.apache.jena.atlas.logging.Log; import org.apache.jena.graph.Graph; import org.apache.jena.query.ARQ; @@ -123,7 +124,7 @@ public class ExecutionContext implements FunctionEnv public Iterator<QueryIterator> listAllIterators() { if ( allIterators == null ) - return null; + return Iter.nullIterator(); return allIterators.iterator(); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/binding/Binding.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/binding/Binding.java index 9bb7fcf4b7..d7c7efbc5c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/binding/Binding.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/binding/Binding.java @@ -57,7 +57,7 @@ public interface Binding /** Iterate over all variables of this binding. */ public Iterator<Var> vars(); - /** Iterate over all variables of this binding. */ + /** Collect all variables of this binding. */ public Set<Var> varsMentioned(); /** Operate on each entry. */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIter.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIter.java index c435afb67d..3dbf653640 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIter.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIter.java @@ -30,7 +30,8 @@ import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.serializer.SerializationContext ; /** - * This class provides the general machinery for iterators. */ + * This class provides the machinery for trackable iterators. + */ public abstract class QueryIter extends QueryIteratorBase { // Volatile just to make it safe to concurrent updates diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIteratorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIteratorBase.java index 77d922f897..4177328edb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIteratorBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIteratorBase.java @@ -35,8 +35,8 @@ import org.apache.jena.sparql.util.PrintSerializableBase; * <ul> * <li>autoclose when the iterator runs out</li> * <li>async cancellation</li> - * <li>final {@link #hasNext()} and {@link #next()} to check for abort. - Implementation provide {@link #hasNextBinding()}, {@link #moveToNextBinding()}</li> + * <li>final {@link #hasNext()} and {@link #next()} to check for cancellation. + Subclasses provide two operations: {@link #hasNextBinding()}, {@link #moveToNextBinding()}</li> * </ul> */ @@ -55,13 +55,14 @@ public abstract class QueryIteratorBase private volatile boolean cancelOnce = false; private Object cancelLock = new Object(); - public QueryIteratorBase() { + /** QueryIteratorBase with no cancellation facility */ + protected QueryIteratorBase() { // No async cancellation. this(null); } /** Argument : shared flag for cancellation. */ - public QueryIteratorBase(AtomicBoolean cancelSignal) { + protected QueryIteratorBase(AtomicBoolean cancelSignal) { if ( cancelSignal == null ) // Allows for direct cancel (not timeout). cancelSignal = new AtomicBoolean(false); @@ -76,12 +77,15 @@ public abstract class QueryIteratorBase // -------- The contract with the subclasses - /** Implement this, not hasNext() */ + /** + * Implement this, not hasNext() + */ protected abstract boolean hasNextBinding(); - /** Implement this, not next() or nextBinding() - Returning null is turned into NoSuchElementException - Does not need to call hasNext (can presume it is true) */ + /** + * Implement this, not next() or nextBinding() Returning null is turned into + * NoSuchElementException Does not need to call hasNext (can presume it is true) + */ protected abstract Binding moveToNextBinding(); /** Close the iterator. */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIteratorCheck.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIteratorCheck.java index 22cc116456..5bd11f71a5 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIteratorCheck.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIteratorCheck.java @@ -28,7 +28,6 @@ import org.apache.jena.sparql.engine.QueryIterator ; import org.apache.jena.sparql.serializer.SerializationContext ; /** Query iterator that checks everything was closed correctly */ - public class QueryIteratorCheck extends QueryIteratorWrapper { private ExecutionContext execCxt ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIteratorWrapper.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIteratorWrapper.java index f49cdb169f..2f524a5e4d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIteratorWrapper.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIteratorWrapper.java @@ -25,7 +25,6 @@ import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.serializer.SerializationContext; /** Wrap a QueryIterator so it can have some/all of it's methods intercepted. */ - public class QueryIteratorWrapper extends QueryIteratorBase { protected QueryIterator iterator; diff --git a/jena-base/src/main/java/org/apache/jena/base/module/SubsystemLifecycle.java b/jena-base/src/main/java/org/apache/jena/base/module/SubsystemLifecycle.java index dd3f1f28c6..703dd6cd6f 100644 --- a/jena-base/src/main/java/org/apache/jena/base/module/SubsystemLifecycle.java +++ b/jena-base/src/main/java/org/apache/jena/base/module/SubsystemLifecycle.java @@ -21,18 +21,24 @@ package org.apache.jena.base.module; /** Lifecycle interface for modules and subsystems. */ public interface SubsystemLifecycle { - /** start - a module should be ready to operate when this returns. */ + /** + * start - a module should be ready to operate when this returns. + */ public void start(); - /** stop - a module should have performed any shutdown operations by the time this returns. - * Caution: code must be prepared to operate without assuming this called. - * Abrupt termination of the JVM is always possible. + /** + * stop - a module should have performed any shutdown operations by the time this + * returns. Caution: code must be prepared to operate without assuming this + * called. Abrupt termination of the JVM is always possible. */ public void stop(); - /** Provide a marker as to the level to order initialization, 10,20,30,... - * See {@link Subsystem} for details. + /** + * Provide a marker as to the level to order initialization, 10,20,30,... See + * {@link Subsystem} for details. */ - default public int level() { return 9999; } + default public int level() { + return 9999; + } } diff --git a/jena-base/src/main/java/org/apache/jena/base/module/package-info.java b/jena-base/src/main/java/org/apache/jena/base/module/package-info.java index ebf297cbfb..de4767081e 100644 --- a/jena-base/src/main/java/org/apache/jena/base/module/package-info.java +++ b/jena-base/src/main/java/org/apache/jena/base/module/package-info.java @@ -27,4 +27,3 @@ */ package org.apache.jena.base.module; -