Calling Connection.commit() would work fine in a non-managed environment
where the connections from the datasource are not under tm control. 
However, since the connections from DefaultDS ARE under tm control, you are
inviting disaster by calling commit on it by hand.  In fact, if you are
using DefaultDS for something else from the same ejb as you used jms from,
such as some BMP, you will get the same connection as you used with the BMP
work, and will be committing that work too!

I think with the separate transaction handling in jdbc pm, the best bet is
to have a separate no-trans datasource and leave the connections
autocommit.  This does work (sort of), doesn't interfere with other uses of
the datasource, and avoids needing to call commit() so often.

Longer term, I think we need a better implementation of jdbc pm, that
relies on the database's transaction management.    I have been thinking a
little bit about this, and think that the best way may be to modify the PM
interface to expose a XAResource: for the jdbc PM this would be the
XAResource from the (jca-wrapped) jdbc driver.  Since the current jdbc
implementation doesn't actually support any kind of transactional recovery,
I don't have a big problem insisting that the jdbc pm be based on a
xa-capable driver.

Also, I think calling any of the pm's xa capable is a bit excessive at this
point since none implement a recover method on the exposed XAResource.

Glad you like the mbean-ref's. I thought they were pretty neat too.  I'd
still like to get rid of the remaining static methods in JMSServer -- I
want to be able to have many running at once, at least so we can test all
the pm's

Thanks!
david jencks

On 2001.11.11 22:14:03 -0500 Charles Chan wrote:
> Hi, David,
> 
> I think JDBC PM relies on MessageLog to commit its
> changes on each method call. I didn't change this. In
> fact, I made JDBC MessageLog to conform to this by
> calling Connection.commit() after each update SQL
> statement is executed.
> 
> Also, if your JMS Session is transacted and if you
> didn't call Session.commit(), the PM will not be
> invoked. So, db transactions are not performed until
> Session.commit() is called.
> 
> Please correct me if I am wrong. I did test my changes
> with a combination of transacted/non-transacted
> sessions with Queue senders and receivers.
> 
> Thanks!
> Charles
> 
> Btw, your mbean-ref changes are really cool. :) Save
> me a lot of time!
> 
> 
> --- David Jencks <[EMAIL PROTECTED]>
> wrote:
> > Are you really sure this change is correct? I have
> > been told that the jdbc
> > pm RELIES on unmanaged connections with autocommit =
> > true.  That is why I
> > created the NoTransDS and used it here.  There is no
> > appropriate
> > transaction control from the container that I can
> > discern.  
> > 
> > I believe with TM-managed transactions on a
> > datasource used in jdbc - pm
> > there is an at least 50% chance that the jdbc
> > DataSource XAResource (or
> > local transaction) will get commit called before the
> > jms-xa XAResource gets
> > commit called - so the db transaction will be
> > comitted before all the
> > end-of-transaction work can be done.  
> > 
> > david jencks
> > 
> > On 2001.11.11 14:43:33 -0500 Charles Chan wrote:
> > >   User: charles_chan
> > >   Date: 01/11/11 11:43:33
> > > 
> > >   Modified:    src/etc/conf/default
> > jbossmq-service.xml
> > >   Log:
> > >   - minor changes to JDBC PM configuration and
> > remove extraneous spaces.
> > >   
> > >   Revision  Changes    Path
> > >   1.10      +28 -21   
> > jbossmq/src/etc/conf/default/jbossmq-service.xml
> > >   
> > >   Index: jbossmq-service.xml
> > >  
> >
> ===================================================================
> > >   RCS file:
> >
> /cvsroot/jboss/jbossmq/src/etc/conf/default/jbossmq-service.xml,v
> > >   retrieving revision 1.9
> > >   retrieving revision 1.10
> > >   diff -u -r1.9 -r1.10
> > >   --- jbossmq-service.xml 2001/11/10 21:38:03     1.9
> > >   +++ jbossmq-service.xml 2001/11/11 19:43:33     1.10
> > >   @@ -7,9 +7,9 @@
> > >    <!--                                           
> >                       
> > >     -->
> > >    <!--
> >
> =====================================================================
> > > -->
> > >    
> > >   -<!-- $Id: jbossmq-service.xml,v 1.9 2001/11/10
> > 21:38:03 d_jencks Exp $
> > > -->
> > >   +<!-- $Id: jbossmq-service.xml,v 1.10 2001/11/11
> > 19:43:33 charles_chan
> > > Exp $ -->
> > >    
> > >   -<!-- 
> > >   +<!--
> > >       |  THis contains the default configuration
> > of jbossmq
> > >       |
> > >      -->
> > >   @@ -33,28 +33,28 @@
> > >        <mbean-ref
> >
> name="PersistenceManager">JBossMQ:service=PersistenceManager</mbean-ref>
> > >        <mbean-ref
> >
> name="StateManager">JBossMQ:service=StateManager</mbean-ref>
> > >      </mbean>
> > >   -        
> > >   -  <!-- 
> > >   +
> > >   +  <!--
> > >         | The MessageCache decides where to put
> > JBossMQ message that
> > >         | are sitting around waiting to be
> > consumed by a client.
> > >         |
> > >         | The memory marks are in Megabytes.  Once
> > the JVM memory usage
> > > hits
> > >         | the high memory mark, the old messages
> > in the cache will start
> > > getting
> > >   -     | stored in the DataDirectory.  As memory
> > usage gets closer to
> > > the 
> > >   +     | stored in the DataDirectory.  As memory
> > usage gets closer to
> > > the
> > >         | Max memory mark, the amount of message
> > kept in the memory cache
> > > aproaches 0.
> > >       -->
> > >   -  <mbean
> > code="org.jboss.mq.server.MessageCache" 
> > >   +  <mbean
> > code="org.jboss.mq.server.MessageCache"
> > >            name="JBossMQ:service=MessageCache">
> > >        <attribute
> > name="HighMemoryMark">500</attribute>
> > >        <attribute
> > name="MaxMemoryMark">600</attribute>
> > >        <attribute
> > name="DataDirectory">tmp/jbossmq</attribute>
> > >      </mbean>
> > >    
> > >   -  <!-- 
> > >   +  <!--
> > >         | The StateManager is used to keep JMS
> > persistent state data.
> > >   -     | For example: what durable subscriptions
> > are active. 
> > >   +     | For example: what durable subscriptions
> > are active.
> > >       -->
> > >   -  <mbean
> > code="org.jboss.mq.server.StateManager" 
> > >   +  <mbean
> > code="org.jboss.mq.server.StateManager"
> > >            name="JBossMQ:service=StateManager">
> > >        <attribute
> >
> name="StateFile">conf/default/jbossmq-state.xml</attribute>
> > >      </mbean>
> > >   @@ -65,15 +65,22 @@
> > >        <attribute
> > name="DataDirectory">db/jbossmq/file/</attribute>
> > >        <mbean-ref
> >
> name="MessageCache">JBossMQ:service=MessageCache</mbean-ref>
> > >      </mbean>
> > >   +
> > >   +  <!--
> > >   +
> > >   +  A JDBC PersistenceManager.
> > >   +  The "DataSource" reference should refer to
> > your datasource
> > >   +  configuration name. Check your
> > <datasource>-service.xml for the
> > > details
> > >    
> > >   -  <!--mbean
> > code="org.jboss.mq.pm.jdbc.PersistenceManager"
> > >   +  <mbean
> > code="org.jboss.mq.pm.jdbc.PersistenceManager"
> > >            name="JBossMQ:service=PersistenceManager">
> > >   -    <mbean-ref
> >
> name="DataSource">JBossMQ:service=ConnectionFactoryLoader,name=NoTransDS</mbean-ref>
> > >   +    <mbean-ref
> >
> 
>name="DataSource">JBOSS-SYSTEM:service=ConnectionFactoryLoader,name=DefaultDS</mbean-ref>
> > >        <mbean-ref
> >
> name="MessageCache">JBossMQ:service=MessageCache</mbean-ref>
> > >   -  </mbean-->
> > >   +  </mbean>
> > >   +  -->
> > >    
> > >   -  <!-- 
> > >   -     | InvocationLayers are the different
> > transport methods that can 
> > >   +  <!--
> > >   +     | InvocationLayers are the different
> > transport methods that can
> > >         | be used to access the server.
> > >       -->
> > >      <mbean
> > code="org.jboss.mq.il.jvm.JVMServerILService"
> > >   @@ -85,7 +92,7 @@
> > >      </mbean>
> > >    
> > >      <mbean
> > code="org.jboss.mq.il.rmi.RMIServerILService"
> > >   -       
> > name="JBossMQ:service=InvocationLayer,type=RMI"> 
> > >   +       
> > name="JBossMQ:service=InvocationLayer,type=RMI">
> > >        <mbean-ref
> >
> name="JBossMQService">JBossMQ:service=Server</mbean-ref>
> > >        <attribute
> >
> name="ConnectionFactoryJNDIRef">RMIConnectionFactory</attribute>
> > >        <attribute
> >
> name="XAConnectionFactoryJNDIRef">RMIXAConnectionFactory</attribute>
> > >   @@ -121,8 +128,8 @@
> > >      </mbean>
> > >    -->
> > >    
> > >   -  <!-- 
> > >   -     | The following three line create 3 topics
> > named: 
> > >   +  <!--
> > >   +     | The following three line create 3 topics
> > named:
> > >         |
> > >         |   testTopic, example, bob
> > >       -->
> > >   @@ -134,17 +141,17 @@
> > >            name="JBossMQ:service=Topic,name=example">
> > >        <mbean-ref
> >
> name="JBossMQService">JBossMQ:service=Server</mbean-ref>
> > >      </mbean>
> > >   -  <mbean
> > code="org.jboss.mq.server.TopicManager" 
> > >   +  <mbean
> > code="org.jboss.mq.server.TopicManager"
> > >            name="JBossMQ:service=Topic,name=bob">
> > >        <mbean-ref
> >
> name="JBossMQService">JBossMQ:service=Server</mbean-ref>
> > >      </mbean>
> > >    
> > >   -  <!-- 
> > >   -     | The following 9 line create 9 topics
> > named: 
> > >   +  <!--
> > >   +     | The following 9 line create 9 topics
> > named:
> > >         |
> > >         |   testQueue, controlQueue, A, B, C, D,
> > E, F, ex
> > >       -->
> > >   -  <mbean
> > code="org.jboss.mq.server.QueueManager" 
> > >   +  <mbean
> > code="org.jboss.mq.server.QueueManager"
> > >            name="JBossMQ:service=Queue,name=testQueue">
> > >        <mbean-ref
> >
> name="JBossMQService">JBossMQ:service=Server</mbean-ref>
> > >      </mbean>
> > >   
> > >   
> > >   
> > > 
> > > _______________________________________________
> > > Jboss-development mailing list
> > > [EMAIL PROTECTED]
> > >
> >
> https://lists.sourceforge.net/lists/listinfo/jboss-development
> > > 
> > > 
> > 
> > _______________________________________________
> > Jboss-development mailing list
> > [EMAIL PROTECTED]
> >
> https://lists.sourceforge.net/lists/listinfo/jboss-development
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Find a job, post your resume.
> http://careers.yahoo.com
> 
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-development
> 
> 

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to