Home » geronimo-2.2-source-release » org.apache.geronimo.openejb » [javadoc | source]

    1   /**
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    *  Unless required by applicable law or agreed to in writing, software
   12    *  distributed under the License is distributed on an "AS IS" BASIS,
   13    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    *  See the License for the specific language governing permissions and
   15    *  limitations under the License.
   16    */
   17   package org.apache.geronimo.openejb;
   18   
   19   import org.apache.geronimo.gbean.annotation.GBean;
   20   import org.apache.geronimo.gbean.annotation.ParamSpecial;
   21   import org.apache.geronimo.gbean.annotation.ParamReference;
   22   import org.apache.geronimo.gbean.annotation.ParamAttribute;
   23   import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
   24   import org.apache.geronimo.gbean.AbstractName;
   25   import org.apache.openejb.assembler.classic.StatelessSessionContainerInfo;
   26   
   27   import java.util.Properties;
   28   
   29   /**
   30    * @version $Rev$ $Date$
   31    */
   32   @GBean
   33   public class StatelessContainerGBean extends EjbContainer {
   34   
   35       /**
   36        * Specifies the time to wait between invocations. This
   37        * value is measured in milliseconds. A value of 5 would
   38        * result in a time-out of 5 milliseconds between invocations.
   39        * A value of zero would mean no timeout.
   40        */
   41       private final int timeout;
   42   
   43       /**
   44        * Specifies the size of the bean pools for this
   45        * stateless SessionBean container.
   46        */
   47   
   48       private final int poolSize;
   49   
   50       /**
   51        * StrictPooling tells the container what to do when the pool
   52        * reaches it's maximum size and there are incoming requests
   53        * that need instances.
   54        * <p/>
   55        * With strict pooling, requests will have to wait for instances
   56        * to become available. The pool size will never grow beyond the
   57        * the set PoolSize value.
   58        * <p/>
   59        * Without strict pooling, the container will create temporary
   60        * instances to meet demand. The instances will last for just one
   61        * method invocation and then are removed.
   62        */
   63       private final boolean strictPooling;
   64   
   65   
   66       public StatelessContainerGBean(
   67               @ParamSpecial(type = SpecialAttributeType.abstractName) AbstractName abstractName,
   68               @ParamReference(name = "OpenEjbSystem") OpenEjbSystem openEjbSystem,
   69               @ParamAttribute(name = "provider") String provider,
   70               @ParamAttribute(name = "poolSize") int poolSize,
   71               @ParamAttribute(name = "strictPooling") boolean strictPooling,
   72               @ParamAttribute(name = "timeout") int timeout,
   73               @ParamAttribute(name = "properties") Properties properties) {
   74           super(abstractName, StatelessSessionContainerInfo.class, openEjbSystem, provider, "STATELESS", properties);
   75           set("PoolSize", Integer.toString(poolSize));
   76           set("StrictPooling", Boolean.toString(strictPooling));
   77           set("TimeOut", Integer.toString(timeout));
   78           this.poolSize = poolSize;
   79           this.strictPooling = strictPooling;
   80           this.timeout = timeout;
   81       }
   82   
   83       public int getPoolSize() {
   84           return poolSize;
   85       }
   86   
   87       public boolean isStrictPooling() {
   88           return strictPooling;
   89       }
   90   
   91       public int getTimeout() {
   92           return timeout;
   93       }
   94   }

Home » geronimo-2.2-source-release » org.apache.geronimo.openejb » [javadoc | source]