[Design of EJB 3.0] - Cache configurations for EJB3 stateful beans
by jaikiran
While updating the reference docs for EJB3, i found this information for JBossAS-4.x related to Stateful bean caching:
anonymous wrote :
| Stateful beans are stored in a cache. This cache is responsible for passivated stateful sessions when the cache becomes too full or a bean is too old. You may want to set things like the max size of this cache, and when beans should become idle. Configuration is different depending on whether you are clustered or not.
|
| Non-Clustered:
| For non clustered stateful beans, the @org.jboss.annotation.ejb.cache.simple.CacheConfig annotation is
| responsible for configuring the cache.
| Clustered:
|
| For non clustered stateful beans, the @org.jboss.annotation.ejb.cache.tree.CacheConfig annotation is
| responsible for configuring the cache.
| No Passivation:
|
| Sometimes it is useful to turn off passivation entirely. This can be done by plugging in the caching implementation using the @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.NoPassivationCache.class) annotation.
The annotations have been now moved to a different location. And based on what i see in the definition of org.jboss.ejb3.annotation.CacheConfig:
| @Retention(RetentionPolicy.RUNTIME)
| @Target(
| {ElementType.TYPE})
| public @interface CacheConfig {
|
| // Class Members
|
| public static final String DEFAULT_CLUSTERED_OBJECT_NAME = "jboss.cache:service=EJB3SFSBClusteredCache";
|
| public static final int DEFAULT_NONCLUSTERED_MAX_SIZE = 100000;
|
| public static final int DEFAULT_CLUSTERED_MAX_SIZE = 10000;
|
| public static final long DEFAULT_IDLE_TIMEOUT_SECONDS = 300;
|
| public static final long DEFAULT_REMOVAL_TIMEOUT_SECONDS = 0;
|
| public static final boolean DEFAULT_REPL_IS_PASV = true;
|
| // Instance Members
|
| String name() default "";
|
| int maxSize() default CacheConfig.DEFAULT_NONCLUSTERED_MAX_SIZE;
|
| long idleTimeoutSeconds() default CacheConfig.DEFAULT_IDLE_TIMEOUT_SECONDS;
|
| boolean replicationIsPassivation() default CacheConfig.DEFAULT_REPL_IS_PASV;
|
| long removalTimeoutSeconds() default CacheConfig.DEFAULT_REMOVAL_TIMEOUT_SECONDS;
| }
Am i right in saying:
1) For Non-Clustered: The @org.jboss.ejb3.annotation.CacheConfig is required to be used on the bean as follows:
@Stateful
| @CacheConfig(maxSize = 1000, idleTimeoutSeconds = 1)
| public class SimpleStatefulBean implements java.io.Serializable, SimpleStatefulRemote, SimpleStatefulLocal
|
2) For Clustered:
@Stateful
| @CacheConfig(name=CacheConfig.DEFAULT_CLUSTERED_OBJECT_NAME, maxSize = 1000, idleTimeoutSeconds = 1)
| @Clustered
| public class SimpleStatefulBean implements java.io.Serializable, SimpleStatefulRemote, SimpleStatefulLocal
|
3) For no passivation:
@Stateful
| @Cache(value="org.jboss.ejb3.cache.NoPassivationCache")
| public class SimpleStatefulBean implements java.io.Serializable, SimpleStatefulRemote, SimpleStatefulLocal
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205604#4205604
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205604
15 years, 3 months
[Design the new POJO MicroContainer] - Re: MutableClassInfo?
by stale.pedersen@jboss.org
"kabir.khan(a)jboss.com" wrote :
| "alesj" wrote :
| | How does this effect the (weak type) cache?
| |
| That is an implementation detail that needs to be reworked internally. Having Class as the key for this won't work since we don't want the class to be loaded. Internally the weak type cache stores class names in a map of cl, so this methods can work
|
| | TypeInfoFactory.getTypeInfo(String name, ClassLoader cl)
| |
| The use of WeakClassCache by Javassist will need revisiting so that it does not try to load the class every time we try to look something up since that is not needed by the underlying implementation.
|
im looking into JavassistTypeInfoFactoryImpl and JavassistTypeInfo with the goal of getting them Mutable compliant (eg. no usage of Class).
the last remaining problem i have with this is JavassistTypeInfo.getType(). with my changes this method will always return null, but this is breaking the testsuite since there are tests that depends on this returning the actual class.
from my point of view the getType() method do not have any meaning for a MutableClassInfo since the type isnt defined yet before the class has been frozen/loaded.
so either we can change the getType() method or we need to create a new implementation of JavassistTypInfo that is mutable compliant.
for reference, take a look at the diff here:http://github.com/stalep/jboss-reflect/commit/a1a396c2203d63ae487fc1...
"kabir.khan(a)jboss.com" wrote :
| Create a wiki page with the work in progress?
atm im using git as a vcs, you can all take a look at it here:
http://github.com/stalep/jboss-reflect - note that i can push changes from the git repo back to jboss-reflect svn when wanted.
ill be posting design ideas/thoughts on a wiki too.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205591#4205591
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205591
15 years, 3 months