1 /* 2 * The contents of this file are subject to the terms 3 * of the Common Development and Distribution License 4 * (the License). You may not use this file except in 5 * compliance with the License. 6 * 7 * You can obtain a copy of the license at 8 * https://glassfish.dev.java.net/public/CDDLv1.0.html or 9 * glassfish/bootstrap/legal/CDDLv1.0.txt. 10 * See the License for the specific language governing 11 * permissions and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL 14 * Header Notice in each file and include the License file 15 * at glassfish/bootstrap/legal/CDDLv1.0.txt. 16 * If applicable, add the following below the CDDL Header, 17 * with the fields enclosed by brackets [] replaced by 18 * you own identifying information: 19 * "Portions Copyrighted [year] [name of copyright owner]" 20 * 21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 22 */ 23 24 package javax.resource.spi.work; 25 26 import java.lang.Object; 27 import java.lang.Runnable; 28 import java.lang.Exception; 29 import java.lang.Throwable; 30 import java.util.EventListener; 31 32 /** 33 * This models a <code>WorkListener</code> instance which would be notified 34 * by the <code>WorkManager</code> when the various <code>Work</code> 35 * processing events (work accepted, work rejected, work started, 36 * work completed) occur. 37 * 38 * The <code>WorkListener</code> instance must not make any thread 39 * assumptions and must be thread-safe ie., a notification could 40 * occur from any arbitrary thread. Further, it must not make any 41 * assumptions on the ordering of notifications. 42 * 43 * @version 1.0 44 * @author Ram Jeyaraman 45 */ 46 public interface WorkListener extends EventListener { 47 48 /** 49 * Invoked when a <code>Work</code> instance has been accepted. 50 */ 51 void workAccepted(WorkEvent e); 52 53 /** 54 * Invoked when a <code>Work</code> instance has been rejected. 55 */ 56 void workRejected(WorkEvent e); 57 58 /** 59 * Invoked when a <code>Work</code> instance has started execution. 60 * This only means that a thread has been allocated. 61 */ 62 void workStarted(WorkEvent e); 63 64 /** 65 * Invoked when a <code>Work</code> instance has completed execution. 66 */ 67 void workCompleted(WorkEvent e); 68 } 69