Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/CancelablePrintJob.java
38829 views
/*1* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.print;2627/**28* This interface is used by a printing application to cancel a29* print job. This interface extends {@link DocPrintJob}. A30* <code>DocPrintJob</code> implementation returned from a print31* service implements this interface if the print job can be32* cancelled. Before trying to cancel33* a print job, the client needs to test if the34* <code>DocPrintJob</code> object returned from the print service35* actually implements this interface. Clients should never assume36* that a <code>DocPrintJob</code> implements this interface. A37* print service might support cancellation only for certain types38* of print data and representation class names. This means that39* only some of the <code>DocPrintJob</code> objects returned from40* a service will implement this interface.41* <p>42* Service implementors are encouraged to implement this optional interface43* and to deliver a javax.print.event.PrintJobEvent.JOB_CANCELLED event44* to any listeners if a job is successfully cancelled with an45* implementation of this interface. Services should also note that an46* implementation of this method may be made from a separate client thread47* than that which made the print request. Thus the implementation of48* this interface must be made thread safe.49*/5051public interface CancelablePrintJob extends DocPrintJob {5253/**54* Stops further processing of a print job.55* <p>56* If a service supports this method it cannot be concluded that57* job cancellation will always succeed. A job may not be able to be58* cancelled once it has reached and passed some point in its processing.59* A successful cancellation means only that the entire job was not60* printed, some portion may already have printed when cancel returns.61* <p>62* The service will throw a PrintException if the cancellation did not63* succeed. A job which has not yet been submitted for printing should64* throw this exception.65* Cancelling an already successfully cancelled Print Job is not66* considered an error and will always succeed.67* <p>68* Cancellation in some services may be a lengthy process, involving69* requests to a server and processing of its print queue. Clients70* may wish to execute cancel in a thread which does not affect71* application execution.72* @throws PrintException if the job could not be successfully cancelled.73*/74public void cancel() throws PrintException;7576}777879