Hi Simon,

Try adding @Scope("COMPOSITE") to your component implementation, for example,

@Scope("COMPOSITE")
class MyComponentImplementation implements MyServiceInterface {
 ...

}

This means that only one instance of the component is created. From
that instance you can do what you need at init/destroy time by marking
operations with @Init and @Destroy. All other operations will be
re-entrant so it's up to you to implement your data access strategy
taking this into account.

Great! Exactly what I was looking for. I also found the reference for SCA annotations on osoa.org, however, that kind of detail is missing somewhat, is there any good document on that topic available somewhere?


We have host extensions to fire up Jetty and Tomcat automatically. We
don't have a host-geronimo. There are two ways you could run Tuscany
in Geronimo. Firstly, and most straighforwardly, you could package
Tuscany inside a WAR and then install that. Secondly we have a Tuscany
plugin for Geronimo in development but it's not done yet. There is
code in the Geronimo code base so you could play with it but I
wouldn't suggest you start there.

OK, I'll keep that in mind in case I want geronimo.


What would be the correct way of to provide connection pooling? As I've read
somewhere, both Tomcat and Jetty provide a way to do this, then there's
apache commons DBCP, and the javax.sql DataSource. I guess, I would prefer
the javax.sql DataSource as it appears to me to provide the cleanest
approach, extensibility and allows to configure details about the database
driver outside of the code by JNDI, but I read that looking up a JNDI
context can be slow and should be cached (i.e. I'd require that there's just
one instance with worker threads) and I have no idea on where to configure
that database resource so that my java service finds it.

I'm hoping someone who knows about connection pooling will pitch in here.

Well, if the connection survives long enough (or reconnects are automatically handled), I'd be happy with one connection for my class instance, that all the threads use to execute queries, so no need to recycle connections. Yet, I'm not sure if this would be safe and I'd still want to define my database driver and location outside of the java code.


All good questions Stefan and if we can come to some conclusions we
should add it to the web page/blog as it seems like a common enough
scenario.

I'm happy to provide my insights (if I should have any).


Best regards

Stefan




Reply via email to