[jboss-dev-forums] [Design of EJB 3.0] - "Empty" default values in annotations

bstansberry@jboss.com do-not-reply at jboss.com
Sat Nov 17 10:35:40 EST 2007


There are a couple of places I've seen quasi-empty values used as defaults for annotation attributes. In both cases, the quasi-empty value can be taken to mean the user is saying "use the server default, whatever that is in the current context".

Question is, how should that "server default" be configured?  Currently it is hard coded. Shouldn't it be externalized?  If so, how, since EJB3 is using class annotations as the mechanism for passing around metadata, rather than mutable objects from jboss-metadata.jar?

Examples:

1) @Clustered.loadBalancePolicy.  Specifies an impl of LoadBalancePolicy interface. Default is LoadBalancePolicy.class, i.e. the interface itself, not an impl.

The clustered proxy factories check for this condition and instantiate a hard coded default impl.  StatelessClusteredProxyFactory uses RoundRobin; stateful uses FirstAvailable.  So, context in which the annotation is applied helps drive the meaning of the attribute.

See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=123791
and http://www.jboss.com/index.html?module=bb&op=viewtopic&t=120423
for discussion of why externalized configuration of these defaults could be helpful.

2) @CacheConfig.name.  Specifies the name of the JBC instance to use to store clustered beans.  Default was "jboss.cache:service=EJB3SFSBClusteredCache"; Al's recent changes converted it to "".  I prefer "" -- using an ObjectName is too much of an implementation detail to be leaking as a default value.

This change in defaults is breaking deployments of clustered SFSBs, so I'm going to have to add code to figure out what to do when the value is "".

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105759#4105759

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105759



More information about the jboss-dev-forums mailing list