KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > impl > model > seda > SedaModel


1 /*
2  * $Id: SedaModel.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.impl.model.seda;
12
13 import org.mule.MuleManager;
14 import org.mule.impl.MuleDescriptor;
15 import org.mule.impl.model.AbstractModel;
16 import org.mule.umo.UMOComponent;
17 import org.mule.umo.UMODescriptor;
18
19 /**
20  * A mule component service model that uses Seda principals to achieve high
21  * throughput by Quing events for compoonents and processing them concurrently.
22  *
23  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
24  * @version $Revision: 3798 $
25  */

26 public class SedaModel extends AbstractModel
27 {
28
29     /**
30      * The time out used for taking from the Seda Queue
31      */

32     private int queueTimeout = MuleManager.getConfiguration().getSynchronousEventTimeout();
33
34     /**
35      * Whether components in this model should be pooled or not
36      */

37     private boolean enablePooling = true;
38
39     /**
40      * Whether to create a new component for every request
41      */

42     protected boolean componentPerRequest = false;
43
44     /**
45      * Returns the model type name. This is a friendly identifier that is used to
46      * look up the SPI class for the model
47      *
48      * @return the model type
49      */

50     public String JavaDoc getType()
51     {
52         return "seda";
53     }
54
55     protected UMOComponent createComponent(UMODescriptor descriptor)
56     {
57         return new SedaComponent((MuleDescriptor)descriptor, this);
58     }
59
60     public int getQueueTimeout()
61     {
62         return queueTimeout;
63     }
64
65     public void setQueueTimeout(int queueTimeout)
66     {
67         this.queueTimeout = queueTimeout;
68     }
69
70     public boolean isEnablePooling()
71     {
72         return enablePooling;
73     }
74
75     public void setEnablePooling(boolean enablePooling)
76     {
77         this.enablePooling = enablePooling;
78     }
79
80     public boolean isComponentPerRequest()
81     {
82         return componentPerRequest;
83     }
84
85     public void setComponentPerRequest(boolean componentPerRequest)
86     {
87         this.componentPerRequest = componentPerRequest;
88     }
89 }
90
Popular Tags