|
From: Colin S. <col...@ex...> - 2003-10-15 15:32:51
|
Rod Johnson wrote: >>W/regards to redefining TransactionAttributeSourceEditor to allow for >>wildcards also in the classname, that's a useful feature, but the >>internal workings of the class would have to change. Right now, using a >>MethodMapTransactionAttributeSource, essentially all the methods of the >>specified classes get added to the transactional method map (if they >>match the method regex). So this approach wouldn't work for regexes at >>the class level. You'd probably have to do matches at runtime, with >>consequently slower performance (although I guess you could cache the >>hits and misses, to alleviate this, making the performance pretty well >>identical on second and subsequent calls to the same method). What do >>you think of this idea >> >> > >I prototyped such an approach a couple of months ago. The performance seemed >not too bad. I haven't committed it. However, maybe I should when I get >time, if people are interested. > > I think this would be useful to some people (although the ability to handle the 'all' case with another mechanism like the specialized TransactionalAttributeSource would cover most of my needs).. If there are performance concerns, it could use a dual approach where regexes on methods only (ie everything up to and including the class name is specified) get handled as they do now, and other regexes get handled with a runtime lookup with cache. My feeling is that the runtime lookup with cache would perform well enough though. One consideration is that the config semantics would change in terms of typos. Right now MethodMapTransactionalAttributeSource gives you an exception if you feed it a FQN which can't be resolved, or there are no matching methods. I like the idea of detecting typos in this fashion, if at all possible. Considering that your code may appear to run fine even without the transaction, if you mess up the regex, I think the error detection is valuable. So if the code is extended, maybe one way to do it would be to have two sets of properties, one which behaves exactly like the present property (config time regexes on methods only), and a new one which adds runtime regex matching on the package and class portion as well. Regards, Colin |