[JCA] - Basic understanding of JCA-Workflow
by LeoLo
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
16 years, 7 months
[Beginner's Corner] - Re: Question about -ds.xml file
by shogun1234
Second solution is what I am looking for.
Sorry I did not explain well and thanks for explaning clearly: )
"PeterJ" wrote : What do you mean by "how can I make ds xml to be portable as well? "? Portable how? 1) To a different operating system? 2) To a database other than Sybase? 3) To a different application server?
|
| 1) The one *-ds.xml file works on all OSes.
|
| 2) I suppose you could use system properties for all the settings in *-ds.xml and then set those properties when running the app server. But then you have to maintain those settings for different databases. It is much easier to have a *-ds.xml file per database. Or do what I do - I have a generic *-ds.xml file and generate the final one using Ant, with Ant properties providing the database-specific parts.
|
| 3) Not possible - each app server has its own way of defining datasources.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4256321#4256321
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4256321
16 years, 7 months
[JBoss Cache Users] - transactions failed when integrated with cache
by sridhar_ratna
Hi,
I am using JBoss Cache 3.1 integrated with Gridgain 2.1.
I built three jboss cache instances with Cache Mode as LOCAL.
For a particular operation, i need to delete data from two caches and merge it with some data in third cache.
Now i want to have these three opeations as atomic unit. for this i have followed the solution provide by "morpheus" in gridgain forum
"What you need is to launch 3 jobs and have them coordinate between each other. So, for example, the 3rd job would have to wait for first two jobs to do the delete operation prior to continuing... If at any point anything fails, you can issue rollback from all jobs.
Take a look at Distributed Task Session for information on how to use task session attributes to coordinate between task and jobs. Also, there are several session examples shipped with GridGain (e.g. +GridifyHelloWorldSessionExample+) "
link to the forum is thread is http://www.gridgainsystems.com/jiveforums/thread.jspa?threadID=862
Now i am trying to implement the same solution and for that i have written a sample program. i have placed the eclipse project at http://www.4shared.com/file/134482628/80d6c0fd/matcher.html.
I have configured the JBossTs as per the installation document and the installation was success.
but when i run the application i am getting the error
[java] java.lang.IllegalStateException: BaseTransaction.rollback - [com.arjuna.ats.internal.jta.transaction.arjunacore.notx] [com.arjuna.ats.internal.jta.transaction.arjunacore.notx] no transaction!
[java] at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.rollback(BaseTransaction.java:158)
[java] at com.cmc.messaging.HelloWorldJob.onMessage(Unknown Source)
[java] at org.gridgain.grid.kernal.managers.communication.GridCommunicationManager$4.body(GridCommunicationManager.java:589)
[java] at org.gridgain.grid.util.runnable.GridRunnable$1.run(GridRunnable.java:142)
[java] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
[java] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
[java] at java.util.concurrent.FutureTask.run(FutureTask.java:138)
[java] at org.gridgain.grid.util.runnable.GridRunnable.run(GridRunnable.java:194)
[java] at org.gridgain.grid.util.runnable.GridRunnablePool$1.run(GridRunnablePool.java:80)
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[java] at java.lang.Thread.run(Thread.java:619)
can any body help me out what was the problem.
In the project enclosed there is an ant script.
first run the target gridNode1
then run the target gridNode2
the run the target hw.
Please help me.
Thanks in advance.
Sridhar
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4256306#4256306
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4256306
16 years, 7 months