KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > controller > loadbalancer > BackendTaskQueueEntry


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
4  * Contact: sequoia@continuent.org
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Initial developer(s): Emmanuel Cecchet.
19  * Contributor(s): ______________________.
20  */

21
22 package org.continuent.sequoia.controller.loadbalancer;
23
24 import java.util.LinkedList JavaDoc;
25
26 import org.continuent.sequoia.controller.loadbalancer.tasks.AbstractTask;
27
28 /**
29  * This class defines a BackendTaskQueueEntry that is an element of a queue in
30  * BackendTaskQueues.
31  *
32  * @see org.continuent.sequoia.controller.loadbalancer.BackendTaskQueues
33  * @author <a HREF="mailto:emmanuel.cecchet@emicnetworks.com">Emmanuel Cecchet</a>
34  * @version 1.0
35  */

36 public class BackendTaskQueueEntry
37 {
38   AbstractTask task;
39   private LinkedList JavaDoc queue;
40   BackendWorkerThread processingThread;
41   private boolean isACommitOrRollback;
42
43   /**
44    * Creates a new <code>BackendTaskQueueEntry</code> object
45    *
46    * @param task the task to put in the entry
47    * @param queue the queue in which the task has been posted
48    * @param isACommitOrRollback true if the task is a commit or a rollback
49    */

50   public BackendTaskQueueEntry(AbstractTask task, LinkedList JavaDoc queue,
51       boolean isACommitOrRollback)
52   {
53     this.task = task;
54     this.queue = queue;
55     this.processingThread = null;
56     this.isACommitOrRollback = isACommitOrRollback;
57   }
58
59   /**
60    * Returns the processingThread value (null if no BackendWorkerThread is
61    * currently processing the task).
62    *
63    * @return Returns the processingThread.
64    */

65   public final BackendWorkerThread getProcessingThread()
66   {
67     return processingThread;
68   }
69
70   /**
71    * Returns the isACommitOrRollback value.
72    *
73    * @return Returns the isACommitOrRollback.
74    */

75   public final boolean isACommitOrRollback()
76   {
77     return isACommitOrRollback;
78   }
79
80   /**
81    * Sets the processingThread value.
82    *
83    * @param processingThread The processingThread to set.
84    */

85   public final void setProcessingThread(BackendWorkerThread processingThread)
86   {
87     this.processingThread = processingThread;
88   }
89
90   /**
91    * Returns the queue in which the task has been posted.
92    *
93    * @return Returns the queue holding the query.
94    */

95   public final LinkedList JavaDoc getQueue()
96   {
97     return queue;
98   }
99
100   /**
101    * Returns the task value.
102    *
103    * @return Returns the task.
104    */

105   public final AbstractTask getTask()
106   {
107     return task;
108   }
109
110   /**
111    * Sets the queue value.
112    *
113    * @param queue The queue to set.
114    */

115   public void setQueue(LinkedList JavaDoc queue)
116   {
117     this.queue = queue;
118   }
119   
120   /**
121    * <strong>for debug purpose only</strong>
122    * @see java.lang.Object#toString()
123    */

124   public String JavaDoc toString()
125   {
126     return getTask().toString();
127   }
128 }
Popular Tags