KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > config > QueueProfile


1 /*
2  * $Id: QueueProfile.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.config;
12
13 import org.mule.MuleManager;
14 import org.mule.umo.lifecycle.InitialisationException;
15 import org.mule.util.queue.QueueConfiguration;
16
17 /**
18  * <code>QueueProfile</code> determines how an internal queue for a component will
19  * behave
20  *
21  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
22  * @author <a HREF="mailto:gnt@codehaus.org">Guillaume Nodet</a>
23  * @version $Revision: 3798 $
24  */

25
26 public class QueueProfile
27 {
28     private int maxOutstandingMessages = 0;
29     private boolean persistent = false;
30
31     public QueueProfile()
32     {
33         super();
34     }
35
36     public QueueProfile(int maxOutstandingMessages, boolean persistent)
37     {
38         this.maxOutstandingMessages = maxOutstandingMessages;
39         this.persistent = persistent;
40     }
41
42     public QueueProfile(QueueProfile queueProfile)
43     {
44         this.maxOutstandingMessages = queueProfile.getMaxOutstandingMessages();
45         this.persistent = queueProfile.isPersistent();
46     }
47
48     /**
49      * This specifies the number of messages that can be queued before it starts
50      * blocking.
51      *
52      * @return the max number of messages that will be queued
53      */

54     public int getMaxOutstandingMessages()
55     {
56         return maxOutstandingMessages;
57     }
58
59     /**
60      * This specifies the number of messages that can be queued before it starts
61      * blocking.
62      *
63      * @param maxOutstandingMessages the max number of messages that will be queued
64      */

65     public void setMaxOutstandingMessages(int maxOutstandingMessages)
66     {
67         this.maxOutstandingMessages = maxOutstandingMessages;
68     }
69
70     public boolean isPersistent()
71     {
72         return persistent;
73     }
74
75     public void setPersistent(boolean persistent)
76     {
77         this.persistent = persistent;
78     }
79
80     public void configureQueue(String JavaDoc component) throws InitialisationException
81     {
82         QueueConfiguration qc = new QueueConfiguration(maxOutstandingMessages, persistent);
83         MuleManager.getInstance().getQueueManager().setQueueConfiguration(component, qc);
84     }
85
86 }
87
Popular Tags