[jboss-user] [JCA] - Basic understanding of JCA-Workflow

LeoLo do-not-reply at jboss.com
Tue Sep 22 05:29:38 EDT 2009


Hi!

I've a JBoss AS 4.2.3 with a very basic SessionBean in it (code below), accessing a Jackrabbit-Repository, that is connected via a JCA-ConnectionFactory.

Assuming the bean is deployed and the service-method deleteNode(...) is executed once. At which point is a connection to jackrabbit taken out of the pool?

When the resource "java:jcr/local" is injected at bean-deployment?

Or when repository.login(...) in the service-method is called?

When is the connection released and returned to the pool? (When session-logout is called or when the transaction is committed or ... ?)

Is it possible, that during a service-method more than one connection may be used?

Any hints and references are really appreciated.

Regards, LeoLo


  | @Stateless
  | @Remote(SimpleService.class)
  | @TransactionAttribute(TransactionAttributeType.REQUIRED)
  | public class SimpleServiceBean implements SimpleService {
  | 
  | 	// JackRabbit-Repository
  | 	@Resource(mappedName = "java:jcr/local")
  | 	private Repository repository;
  | 	
  | 	public void deleteNode (String path) {
  | 
  | 		Session session = null;
  | 		String pathLocal = null;
  | 		Node oldNode    = null;
  | 	
  | 		try {
  | 			// JackRabbit access via JNDI
  | 			session = this.repository.login(new SimpleCredentials("user", "pass".toCharArray()), "default");
  | 				
  | 			Node rootNode = session.getRootNode();
  | 
  | 			oldNode = rootNode.getNode(pathLocal);
  | 			oldNode.remove();
  |                         session.save();
  | 		}
  | 		catch (RepositoryException re) {
  | 			log.error(re.getMessage(), re);
  | 		}
  | 		finally {
  | 			session.logout();
  | 		}
  | 	}
  | 

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

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



More information about the jboss-user mailing list