KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > web > connector > grizzly > TaskEvent


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 com.sun.enterprise.web.connector.grizzly;
25
26 /**
27  * Sample event object used by instance of <code>TaskListener</code> to share
28  * status information about where they are when processing a request.
29  *
30  * @author Jean-Francois Arcand
31  */

32 public class TaskEvent<E> {
33  
34     public final static int START = 0;
35     public final static int ERROR = 1;
36     public final static int COMPLETED = 2;
37     public final static int CONTINUE = 3;
38     public final static int START_ASYNCHRONOUS = 4;
39     
40     private int status;
41     
42  
43     public int getStatus(){
44         return status;
45     }
46     
47     
48     public void setStatus(int status){
49         this.status = status;
50     }
51
52     
53     /**
54      * The associated <code>TaskContext</code> instance. Can be null.
55      */

56     protected E ctx;
57
58     
59     /**
60      * Create an instance and associated the <code>TaskContext</code> object.
61      */

62     public TaskEvent(E ctx){
63         this.ctx = ctx;
64     }
65     
66     
67     /**
68      * Create an empty instance.
69      */

70     public TaskEvent(){
71     }
72   
73     
74     /**
75      * Set <code>TaskContext</code> instance. Can be null.
76      */

77     public void attach(E ctx){
78         this.ctx = ctx;
79     }
80
81     
82     /**
83      * Return the <code>TaskContext</code> instance. Can be null.
84      */

85     public E attachement(){
86         return ctx;
87     }
88     
89     
90     
91 }
92
93
94
Popular Tags