| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.trans; |
| 9 | |
| 10 | /** |
| 11 | * An exception used to signal that no more input is required from the parser, and that |
| 12 | * parsing can therefore be abandoned early (but without signaling any error to the user) |
| 13 | */ |
| 14 | public class QuitParsingException extends XPathException { |
| 15 | |
| 16 | private boolean notifiedByConsumer = false; |
| 17 | |
| 18 | /** |
| 19 | * Create a QuitParsingException |
| 20 | * |
| 21 | * @param notifiedByConsumer should be set to true if the exception was generating in the parsing |
| 22 | * thread in response to an interrupt from the consuming thread; in this case |
| 23 | * there is no need for the consuming thread to be notified of the termination |
| 24 | * (by sending a "stopper" item); and indeed, doing so causes the thread to hang. |
| 25 | * See bug 3080. |
| 26 | */ |
| 27 | public QuitParsingException(boolean notifiedByConsumer) { |
| 28 | super("No more input required", "SXQP0001"); |
| 29 | this.notifiedByConsumer = notifiedByConsumer; |
| 30 | } |
| 31 | |
| 32 | public boolean isNotifiedByConsumer() { |
| 33 | return notifiedByConsumer; |
| 34 | } |
| 35 | } |
| 36 |