openejb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hogst...@apache.org
Subject svn commit: r462652 - in /incubator/openejb/trunk/openejb2/modules: openejb-builder/src/main/java/org/apache/openejb/deployment/ openejb-builder/src/main/xsd/ openejb-core/src/main/java/org/apache/openejb/
Date Wed, 11 Oct 2006 01:01:31 GMT
Author: hogstrom
Date: Tue Oct 10 18:01:30 2006
New Revision: 462652

URL: http://svn.apache.org/viewvc?view=rev&rev=462652
Log:
Added support to adjust cache size of Stateless Session beans through deployment plan

Modified:
    incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/java/org/apache/openejb/deployment/StatelessBuilder.java
    incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/java/org/apache/openejb/deployment/XmlBeansSessionBuilder.java
    incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/xsd/openejb-jar-2.2.xsd
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeployment.java
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeploymentFactory.java
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeploymentGBean.java

Modified: incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/java/org/apache/openejb/deployment/StatelessBuilder.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/java/org/apache/openejb/deployment/StatelessBuilder.java?view=diff&rev=462652&r1=462651&r2=462652
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/java/org/apache/openejb/deployment/StatelessBuilder.java
(original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/java/org/apache/openejb/deployment/StatelessBuilder.java
Tue Oct 10 18:01:30 2006
@@ -29,6 +29,8 @@
 public class StatelessBuilder extends SessionBuilder {
     private String serviceEndpointInterfaceName;
     private List handlerInfos;
+    private int cacheSize = 1;
+
     public void setServiceEndpointInterfaceName(String serviceEndpointInterfaceName) {
         this.serviceEndpointInterfaceName = serviceEndpointInterfaceName;
     }
@@ -37,6 +39,14 @@
         this.handlerInfos = handlerInfos;
     }
 
+    public void setCacheSize(int cacheSize) {
+        if (cacheSize > 0) this.cacheSize = cacheSize;
+    }
+
+    public int getCacheSize() {
+        return cacheSize;
+    }
+
     protected GBeanInfo getTargetGBeanInfo() {
         return StatelessEjbDeploymentGBean.GBEAN_INFO;
     }
@@ -49,6 +59,7 @@
         GBeanData gbean = super.createConfiguration();
         gbean.setAttribute("handlerInfos", handlerInfos);
         gbean.setAttribute("serviceEndpointInterfaceName", serviceEndpointInterfaceName);
+        gbean.setAttribute("cacheSize", new Integer(cacheSize));
         return gbean;
     }
 }

Modified: incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/java/org/apache/openejb/deployment/XmlBeansSessionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/java/org/apache/openejb/deployment/XmlBeansSessionBuilder.java?view=diff&rev=462652&r1=462651&r2=462652
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/java/org/apache/openejb/deployment/XmlBeansSessionBuilder.java
(original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/java/org/apache/openejb/deployment/XmlBeansSessionBuilder.java
Tue Oct 10 18:01:30 2006
@@ -55,9 +55,13 @@
 import org.apache.openejb.StatelessEjbDeploymentGBean;
 import org.apache.openejb.xbeans.ejbjar.OpenejbSessionBeanType;
 import org.apache.openejb.xbeans.ejbjar.OpenejbWebServiceSecurityType;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 
 public class XmlBeansSessionBuilder extends XmlBeanBuilder {
+    private static final Log log = LogFactory.getLog(XmlBeansSessionBuilder.class);
+
     private final static String DEFAULT_AUTH_REALM_NAME = "Geronimo Web Service";
 
     private final String defaultStatelessEjbContainer;
@@ -65,9 +69,9 @@
     private final GBeanData linkDataTemplate;
 
     public XmlBeansSessionBuilder(OpenEjbModuleBuilder moduleBuilder,
-            String defaultStatelessEjbContainer,
-            String defaultStatefulEjbContainer,
-            GBeanData linkDataTemplate) {
+                                  String defaultStatelessEjbContainer,
+                                  String defaultStatefulEjbContainer,
+                                  GBeanData linkDataTemplate) {
         super(moduleBuilder);
 
         this.defaultStatelessEjbContainer = defaultStatelessEjbContainer;
@@ -152,6 +156,18 @@
         if (isStateless) {
             StatelessBuilder statelessBuilder = new StatelessBuilder();
             statelessBuilder.setEjbContainerName(defaultStatelessEjbContainer);
+            int cacheSize = 1;
+
+            if (openejbSessionBean != null && openejbSessionBean.isSetCacheSize())
{
+                cacheSize = openejbSessionBean.getCacheSize();
+                if (cacheSize < 1) {
+                    log.warn("Cache Size was less than 1 for Stateless bean "+
+                              openejbSessionBean.getEjbName()+" which is invalid.  Cache
size changed"+
+                              " to the default of 1.");
+                }
+            }
+
+            statelessBuilder.setCacheSize(cacheSize);
 
             // Web services configuration
             String serviceEndpointName = OpenEjbModuleBuilder.getJ2eeStringValue(sessionBean.getServiceEndpoint());
@@ -160,6 +176,10 @@
             xmlBeansSecurityBuilder.addToPermissions(toBeChecked, ejbName, "ServiceEndpoint",
serviceEndpointName, cl);
             sessionBuilder = statelessBuilder;
         } else {
+            if (openejbSessionBean != null &&
+                    openejbSessionBean.isSetCacheSize())
+                log.warn("Cache Size was specified for Stateful bean "+openejbSessionBean.getEjbName()+
+                         " and will be ignored.  Cache size is only valid for Stateless Session
Beans.");
             StatefulBuilder statefulBuilder = new StatefulBuilder();
             statefulBuilder.setEjbContainerName(defaultStatefulEjbContainer);
 

Modified: incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/xsd/openejb-jar-2.2.xsd
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/xsd/openejb-jar-2.2.xsd?view=diff&rev=462652&r1=462651&r2=462652
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/xsd/openejb-jar-2.2.xsd
(original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-builder/src/main/xsd/openejb-jar-2.2.xsd
Tue Oct 10 18:01:30 2006
@@ -81,6 +81,7 @@
             <xs:element name="ejb-name" type="xs:string"/>
             <xs:element name="jndi-name" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
             <xs:element name="local-jndi-name" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element name="cache-size" type="xs:int" minOccurs="0"/>
             <xs:group ref="openejb:tssGroup" minOccurs="0"/>
 
             <xs:group ref="naming:jndiEnvironmentRefsGroup"/>
@@ -176,6 +177,7 @@
                         </xs:sequence>
                     </xs:complexType>
                 </xs:element>
+                <xs:element name="select-for-update" type="xs:boolean" minOccurs="0"/>
             </xs:sequence>
 
             <xs:element name="cache" minOccurs="0">

Modified: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeployment.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeployment.java?view=diff&rev=462652&r1=462651&r2=462652
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeployment.java
(original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeployment.java
Tue Oct 10 18:01:30 2006
@@ -63,6 +63,7 @@
                                   String serviceEndpointInterfaceName,
                                   String beanClassName,
                                   ClassLoader classLoader,
+                                  int cacheSize,
 
                                   StatelessEjbContainer ejbContainer,
 
@@ -99,6 +100,7 @@
                 loadClass(serviceEndpointInterfaceName, classLoader, "service endpoint interface"),
                 loadClass(beanClassName, classLoader, "bean class"),
                 classLoader,
+                cacheSize,
                 ejbContainer,
                 jndiNames,
                 localJndiNames,
@@ -126,6 +128,7 @@
                                   Class serviceEndpointInterface,
                                   Class beanClass,
                                   ClassLoader classLoader,
+                                  int cacheSize,
 
                                   StatelessEjbContainer ejbContainer,
 
@@ -185,7 +188,7 @@
 
         InstanceFactory instanceFactory = new StatelessInstanceFactory(contextFactory);
 
-        instancePool = new SoftLimitedInstancePool(instanceFactory, 1);
+        instancePool = new SoftLimitedInstancePool(instanceFactory, cacheSize);
 
         this.handlerInfos = handlerInfos;
     }
@@ -254,4 +257,4 @@
         return handlerInfos;
     }
 
-}
+}
\ No newline at end of file

Modified: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeploymentFactory.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeploymentFactory.java?view=diff&rev=462652&r1=462651&r2=462652
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeploymentFactory.java
(original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeploymentFactory.java
Tue Oct 10 18:01:30 2006
@@ -25,6 +25,7 @@
     protected boolean beanManagedTransactions;
     private String serviceEndpointInterfaceName;
     private List handlerInfos;
+    private int cacheSize = 1;
 
     public boolean isBeanManagedTransactions() {
         return beanManagedTransactions;
@@ -50,6 +51,14 @@
         this.handlerInfos = handlerInfos;
     }
 
+    public int getCacheSize() {
+        return cacheSize;
+    }
+
+    public void setCacheSize(int cacheSize) {
+        this.cacheSize = cacheSize;
+    }
+
     public Object create() throws Exception {
         if (classLoader == null) {
             classLoader = Thread.currentThread().getContextClassLoader();
@@ -75,6 +84,8 @@
                 beanClass,
 
                 classLoader,
+                cacheSize,
+
                 (StatelessEjbContainer) ejbContainer,
                 jndiNames,
                 localJndiNames,
@@ -92,4 +103,4 @@
                 applicationManagedSecurityResources,
                 handlerInfos);
     }
-}
+}
\ No newline at end of file

Modified: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeploymentGBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeploymentGBean.java?view=diff&rev=462652&r1=462651&r2=462652
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeploymentGBean.java
(original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/StatelessEjbDeploymentGBean.java
Tue Oct 10 18:01:30 2006
@@ -49,6 +49,7 @@
         infoFactory.addAttribute("serviceEndpointInterfaceName", String.class, true);
         infoFactory.addAttribute("beanClassName", String.class, true);
         infoFactory.addAttribute("classLoader", ClassLoader.class, false);
+        infoFactory.addAttribute("cacheSize", int.class, true);
 
         infoFactory.addReference("ejbContainer", StatelessEjbContainer.class, "StatelessEjbContainer");
 
@@ -85,6 +86,7 @@
                 "serviceEndpointInterfaceName",
                 "beanClassName",
                 "classLoader",
+                "cacheSize",
 
                 "ejbContainer",
 



Mime
View raw message