Connection striping (or labeling) involves applying user-defined attributes to a
connection and making the state of the attributes persist when the connection is returned
back to the cache. This striping speeds up future connection retrieval, because cached
connections don't have to reinitialize their state every time they are retrieved.
For example:
- You may run "alter session ..." statements in your ConnectionProvider
implementation before returning from the getConnection() method.
- It would be great if you didn't have to do this, every single time you called
getConnection().
- Usually when the connection is closed, it will be returned to the DataSource configured
in JBoss. It would be beneficial if the connection was tagged in order to mark the changes
that have already been made to it, then we would be able to avoid running need-less alter
session statements on the connection when our ConnectionProvider gets it again from the
DataSource.
java.util.Properties connAttr = null;
connAttr.setProperty("NLS_LANG", "ISO-LATIN-1");
conn = ds.getConnection(connAttr);
1) What is a good way to implement such a scheme in Hibernate to work with JBoss?
2) I'm having problems identifying the connections returned from the DataSource
because they are always wrapped in a new wrapper. Can anyone suggest an intelligent way of
identifying the connections that are are simply being RE-returned from the
DataSource's pool?
I'm hoping to use the ConnectionProvider, itself, to maintain a map of the connections
that it has already initialized but I can't do that if I can't identify
connections when they come back wrapped in a new object from the DataSource :(
Is there an interface or class that can be used to gain some control over the JBoss
DataSource or plug into it?
I was thinking about working with the Hibernate's Cache and CacheProvider interfaces
to come up with a solution but right now ... I can't imagine how I would be able to
implement tagging on (specify Properties for) each of the connections.
Any one out there with some comments?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4212802#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...