Skip to content

Multi-threaded Queries, Terminating Queries and old Query.lock() not necessary anymore #15

@ssardina

Description

@ssardina

The JPL documentation includes a section on Multi-Threaded Queries that makes total sense. However, there seems to not be anymore the public static method Query.lock to be used in the applications.

All core query predicates (e.g., hasSolution) are synchronized static methods, but when combined with iteration, issues may arise if I understood well.

I went back even to the first commit of the repo and I couldn't find that lock() method, even though they are referred to in the source code, for example:

To ensure thread-safety, you should wrap sequential calls to
	 * this method in a synchronized block, using the static
	 * lock method to obtain the monitor.
	 * <pre>
	 * Query q = // obtain Query reference
	 * synchronized ( jpl.Query.lock() ){
	 *     while ( q.hasMoreElements() ){
	 *          Hashtable solution = q.nextSolution();
	 *          // process solution...
	 *     }
	 * }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions