You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "Howard W. Smith, Jr." <sm...@gmail.com> on 2013/11/03 14:55:07 UTC

Using TomEE/OpenEJB and failover of datasources

First of all, thanks Romain for recommending the following, and for that I
will gladly start a new thread. :)

TomEE/OpenEJB and failover of datasources[1]

which references

[OpenEJB] Dynamic Datasource[2]

but I found the following  TomEE example:

[TomEE] Dynamic Datasource Routing[3]

So, before I begin, my questions are as follows:

1. I recognized that failover[1] says that the idea is to 'reuse' dynamic
datasource. Does this mean that we should code openejb[2] or tomee[3]
dynamic datasource, first, and then reference accordingly via failover[1]?

2. or failover[1] requires no coding on our part? only developer needs to
setup the failover 'config'?

3. also, tomee[3] dynamic datasource routing recommends openejb.xml
(instead of tomee.xml). can openejb.xml cofiguration be placed in
tomee.xml, too, or not?

4. okay, never mind, I was abouto ask for some clarification about
META-INF/org.router/service-jar.xml, but I 'found' service-jar.xml on
trunk[4]. :)



[1]
http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/

[2] http://tomee.apache.org/dynamic-datasource.html

[3]
http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html

[4]
http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml

Re: Using TomEE/OpenEJB and failover of datasources

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
i guess my question really is... since I stop derby before main & fallback
datasources are closed, is it likely that this might interrupt data
integrity? is it possible that I will lose data since my app stops derby
prior to tomee/openejb failover stops datasources...at tomee shutdown/stop?



On Sun, Nov 3, 2013 at 10:18 AM, Howard W. Smith, Jr. <
smithh032772@gmail.com> wrote:

> FYI, I just stopped my local tomee, and recognized that my @Application
> @PreDestroy has my code that stops Apache Derby prior to main and fallback
> datasources are closed.
>
> is this okay?
>
> Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardServer await
> INFO: A valid shutdown command was received via the shutdown port.
> Stopping the Server instance.
> Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> INFO: Pausing ProtocolHandler ["http-nio-8080"]
> Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
> Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardService
> stopInternal
> INFO: Stopping service Catalina
> Nov 03, 2013 10:12:48 AM pf.LoginFilter destroy
> INFO: ...
> Nov 03, 2013 10:12:48 AM org.apache.openejb.assembler.classic.Assembler
> destroyApplication
> INFO: Undeploying app: C:\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\mcmsweb
> Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> INFO: BEGIN
> Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> INFO: DerbyUtil.java: shutdown() invoked
> Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil loadDriver
> INFO: DerbyUtil.java: loadDriver(): Loaded driver
> (org.apache.derby.jdbc.EmbeddedDriver) successfully
> Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> INFO: DerbyUtil.java: shutdown(): Derby shut down normally
> Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> INFO: gCalUtil.shutdown() completed
> Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> INFO: jodConverter.shutdown() completed
> Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> INFO: ApplicationMessageBean.shutdown() BEGIN
> Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> INFO: ApplicationMessageBean.shutdown() END
> Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> INFO: applicationMessageBean.shutdown() completed
> Nov 03, 2013 10:12:48 AM pf.ThreadLocalImmolater immolate
> INFO: immolated 305 values in ThreadLocals
> Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> INFO: END
> Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker stop
> INFO: Stopping
> Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker stop
> INFO: Stopping
> [EL Info]: 2013-11-03
> 10:12:48.682--ServerSession(1206174612)--file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/mcmsweb/WEB-INF/classes/_mcmsPU
> logout successful
> Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreads
> SEVERE: The web application [/mcmsweb] appears to have started a thread
> named [PoolIdleReleaseTimer] but has failed to stop it. This is very likely
> to create a memory leak.
> Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreads
> SEVERE: The web application [/mcmsweb] appears to have started a thread
> named [ActiveMQ VMTransport: vm://localhost#5-5] but has failed to stop it.
> This is very likely to create a memory leak.
> Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreads
> SEVERE: The web application [/mcmsweb] appears to have started a thread
> named [ActiveMQ VMTransport: vm://localhost#5-6] but has failed to stop it.
> This is very likely to create a memory leak.
> Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreads
> SEVERE: The web application [/mcmsweb] appears to have started a thread
> named [ActiveMQ VMTransport: vm://localhost#4-4] but has failed to stop it.
> This is very likely to create a memory leak.
> Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> INFO: Stopping ProtocolHandler ["http-nio-8080"]
> Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
> Nov 03, 2013 10:12:57 AM org.apache.openejb.server.SimpleServiceManager
> stop
> INFO: Stopping server services
> Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutting down.
> Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler standby
> INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB paused.
> Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler unregisterJMX
> INFO: Scheduler unregistered from name
> 'quartz:type=QuartzScheduler,name=OpenEJB-TimerService-Scheduler,instance=OpenEJB'
> in the local MBeanServer.
> Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutdown complete.
> Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> destroyApplication
> INFO: Undeploying app: openejb
> Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> destroyResource
> INFO: Closing DataSource: main
> Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> destroyResource
> INFO: Closing DataSource: fallback
> Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> destroyResource
> INFO: Stopping ResourceAdapter: Default JMS Resource Adapter
> Nov 03, 2013 10:12:57 AM
> org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stop
> INFO: Stopping ActiveMQ
> Nov 03, 2013 10:12:58 AM
> org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stopImpl
> INFO: Stopped ActiveMQ broker
> Nov 03, 2013 10:12:58 AM org.apache.openejb.assembler.classic.Assembler
> destroyResource
> INFO: Closing DataSource: Default Unmanaged JDBC Database
> Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> INFO: Destroying ProtocolHandler ["http-nio-8080"]
> Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
>
>
>
> On Sun, Nov 3, 2013 at 9:55 AM, Howard W. Smith, Jr. <
> smithh032772@gmail.com> wrote:
>
>> okay, i set it up as your post demonstrated, I tested already, and I see
>> no issues. it's time to test this in production. :)
>>
>> thanks romain! like i said in the other thread, I wish I knew about this
>> earlier.
>>
>>
>>
>> On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
>> smithh032772@gmail.com> wrote:
>>
>>> So, the following replaces service-jar.xml (as per your post)?
>>>
>>> <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
>>>    router = failover-router
>>> </Resource>
>>>
>>> and if I wanted to use the 'strategy' parameter, I would add to Resource
>>> as demonstrated below?
>>>
>>> <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
>>>    router = failover-router
>>>    strategy = random
>>> </Resource>
>>>
>>>
>>>
>>>
>>> On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <
>>> rmannibucau@gmail.com> wrote:
>>>
>>>> Hi
>>>>
>>>> Failover is native but to customiee the algo you can code anything you
>>>> want
>>>>
>>>> Tomee.xml is openejb.xml
>>>>
>>>> Service-jar.xml is today useless (see my post)
>>>> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <sm...@gmail.com> a
>>>> écrit :
>>>>
>>>> > First of all, thanks Romain for recommending the following, and for
>>>> that I
>>>> > will gladly start a new thread. :)
>>>> >
>>>> > TomEE/OpenEJB and failover of datasources[1]
>>>> >
>>>> > which references
>>>> >
>>>> > [OpenEJB] Dynamic Datasource[2]
>>>> >
>>>> > but I found the following  TomEE example:
>>>> >
>>>> > [TomEE] Dynamic Datasource Routing[3]
>>>> >
>>>> > So, before I begin, my questions are as follows:
>>>> >
>>>> > 1. I recognized that failover[1] says that the idea is to 'reuse'
>>>> dynamic
>>>> > datasource. Does this mean that we should code openejb[2] or tomee[3]
>>>> > dynamic datasource, first, and then reference accordingly via
>>>> failover[1]?
>>>> >
>>>> > 2. or failover[1] requires no coding on our part? only developer
>>>> needs to
>>>> > setup the failover 'config'?
>>>> >
>>>> > 3. also, tomee[3] dynamic datasource routing recommends openejb.xml
>>>> > (instead of tomee.xml). can openejb.xml cofiguration be placed in
>>>> > tomee.xml, too, or not?
>>>> >
>>>> > 4. okay, never mind, I was abouto ask for some clarification about
>>>> > META-INF/org.router/service-jar.xml, but I 'found' service-jar.xml on
>>>> > trunk[4]. :)
>>>> >
>>>> >
>>>> >
>>>> > [1]
>>>> >
>>>> >
>>>> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
>>>> >
>>>> > [2] http://tomee.apache.org/dynamic-datasource.html
>>>> >
>>>> > [3]
>>>> >
>>>> >
>>>> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
>>>> >
>>>> > [4]
>>>> >
>>>> >
>>>> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
>>>> >
>>>>
>>>
>>>
>>
>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
okay, good. that shows that I understood your blog/post, correctly, and add
this to my app, accordingly. thanks!


On Sun, Nov 3, 2013 at 4:20 PM, Romain Manni-Bucau <rm...@gmail.com>wrote:

> Failover is a facase over normal resources. Only these resource can/should
> be pooled
> Le 3 nov. 2013 21:51, "Howard W. Smith, Jr." <sm...@gmail.com> a
> écrit :
>
> > interesting. I can definitely use this as a reference if (ever)
> necessary,
> > thanks.
> >
> > which brings me to my next question,
> >
> >         //
> >         // take care next strategies can break multiple calls on the
> facade
> >         // it is only intended to be used for connection selection
> >         //
> >
> >
> > I recognized that in the code. I know I make many calls to @Stateless
> @EJB
> > facade objects to read/write data from/to database, and I also configured
> > tomcat jdbc pool  to allow for many connections...in/via tomee.xml
> > <Resource .../>.
> >
> > so, my question... what is the rule of thumb when configuring jdbc pool
> and
> > tomee/openejb failover via dynamic datasources? on my development/test
> > server, I have the following:
> >
> > <Resource id="jdbc/main" type="javax.sql.DataSource">
> >   JdbcDriver org.apache.derby.jdbc.EmbeddedDriver
> >   JdbcUrl jdbc:derby:C:/javadb/databases/mcmsdev;create=true
> >   UserName ....
> >   Password ....
> >   JtaManaged true
> >   jmxEnabled true
> >   LogSql false
> >   InitialSize 10
> >   MaxActive 100
> >   MaxIdle 30
> >   MaxWait 10000
> >   minIdle 10
> >   suspectTimeout 60
> >   removeAbandoned true
> >   removeAbandonedTimeout 180
> >   timeBetweenEvictionRunsMillis 30000
> >   jdbcInterceptors=StatementCache(max=128)
> > </Resource>
> >
> > <Resource id="jdbc/fallback" type="javax.sql.DataSource">
> >   JdbcDriver org.apache.derby.jdbc.EmbeddedDriver
> >   JdbcUrl jdbc:derby:C:/javadb/databases/mcms;create=true
> >   UserName ....
> >   Password ....
> >   JtaManaged true
> >   jmxEnabled true
> >   LogSql false
> >   InitialSize 10
> >   MaxActive 100
> >   MaxIdle 30
> >   MaxWait 10000
> >   minIdle 10
> >   suspectTimeout 60
> >   removeAbandoned true
> >   removeAbandonedTimeout 180
> >   timeBetweenEvictionRunsMillis 30000
> >   jdbcInterceptors=StatementCache(max=128)
> > </Resource>
> >
> > <Resource id="failover-router"
> > class-name="org.apache.openejb.resource.jdbc.router.FailOverRouter">
> >    datasourceNames = jdbc/main,jdbc/fallback
> > </Resource>
> >
> > <Resource id="jdbc/mcmsJta" type="DataSource"
> provider="RoutedDataSource">
> >   router = failover-router
> > </Resource>
> >
> > should I be configuring tomcat jdbc pooling on the dynamic datasources,
> or
> > on the routed datasource? also, I recognized something in the log file,
> > since RoutedDataSource has no URL, the following shows up in the log when
> > starting TomEE:
> >
> > INFO: Creating Resource(id=jdbc/mcmsJta)
> > Nov 03, 2013 9:19:04 AM org.apache.openejb.assembler.classic.Assembler
> > createResource
> > INFO: can't find url for jdbc/mcmsJta will not monitor it
> >
> >
> >
> >
> > On Sun, Nov 3, 2013 at 10:52 AM, Romain Manni-Bucau
> > <rm...@gmail.com>wrote:
> >
> > >  lookhttp://
> > >
> >
> svn.apache.org/repos/asf/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/FailOverRouter.java
> > > last method
> > >
> > > it can still be enhanced a lot
> > > Romain Manni-Bucau
> > > Twitter: @rmannibucau
> > > Blog: http://rmannibucau.wordpress.com/
> > > LinkedIn: http://fr.linkedin.com/in/rmannibucau
> > > Github: https://github.com/rmannibucau
> > >
> > >
> > >
> > > 2013/11/3 Howard W. Smith, Jr. <sm...@gmail.com>:
> > > > okay, and one last question, is there a bit more documentation on the
> > > > following, so we can know what to expect, and the implementation is
> > quite
> > > > sound, working as designed and no known issues with the following?
> > > >
> > > > <ul>
> > > > <li>default: the first is used while possible and others datasources
> > are
> > > > just backup, this is typically the failover case</li>
> > > > <li>random: any datasource of the list is used</li>
> > > > <li>reverse: between two call to a method the list is reversed</li>
> > > > <li>round-robin[%N]: round robin between datasources, you can specify
> > how
> > > > many step you browse between two calls using N (default is 1)</li>
> > > > </ul>
> > > >
> > > > i saw the limitations on the referenced pages (dynamic datasources),
> > but
> > > I
> > > > didn't see any known issues in your/Romain's post/blog.
> > > >
> > > > please excuse my ignorance, if I have not heard or seen much chatter
> > > about
> > > > this on the mail list. I usually try to pay attention to almost all
> > tomee
> > > > emails, especially those that interest me the most. :)
> > > >
> > > >
> > > >
> > > >
> > > > On Sun, Nov 3, 2013 at 10:22 AM, Romain Manni-Bucau
> > > > <rm...@gmail.com>wrote:
> > > >
> > > >> If you dont use it then thats ok. We close the pool then, not
> > > connections
> > > >> Le 3 nov. 2013 16:19, "Howard W. Smith, Jr." <
> smithh032772@gmail.com>
> > a
> > > >> écrit :
> > > >>
> > > >> > FYI, I just stopped my local tomee, and recognized that my
> > > @Application
> > > >> > @PreDestroy has my code that stops Apache Derby prior to main and
> > > >> fallback
> > > >> > datasources are closed.
> > > >> >
> > > >> > is this okay?
> > > >> >
> > > >> > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardServer
> > await
> > > >> > INFO: A valid shutdown command was received via the shutdown port.
> > > >> Stopping
> > > >> > the Server instance.
> > > >> > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> > > >> > INFO: Pausing ProtocolHandler ["http-nio-8080"]
> > > >> > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> > > >> > INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
> > > >> > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardService
> > > >> > stopInternal
> > > >> > INFO: Stopping service Catalina
> > > >> > Nov 03, 2013 10:12:48 AM pf.LoginFilter destroy
> > > >> > INFO: ...
> > > >> > Nov 03, 2013 10:12:48 AM
> > > org.apache.openejb.assembler.classic.Assembler
> > > >> > destroyApplication
> > > >> > INFO: Undeploying app:
> > > >> C:\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\mcmsweb
> > > >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > >> > INFO: BEGIN
> > > >> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> > > >> > INFO: DerbyUtil.java: shutdown() invoked
> > > >> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil loadDriver
> > > >> > INFO: DerbyUtil.java: loadDriver(): Loaded driver
> > > >> > (org.apache.derby.jdbc.EmbeddedDriver) successfully
> > > >> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> > > >> > INFO: DerbyUtil.java: shutdown(): Derby shut down normally
> > > >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > >> > INFO: gCalUtil.shutdown() completed
> > > >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > >> > INFO: jodConverter.shutdown() completed
> > > >> > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> > > >> > INFO: ApplicationMessageBean.shutdown() BEGIN
> > > >> > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> > > >> > INFO: ApplicationMessageBean.shutdown() END
> > > >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > >> > INFO: applicationMessageBean.shutdown() completed
> > > >> > Nov 03, 2013 10:12:48 AM pf.ThreadLocalImmolater immolate
> > > >> > INFO: immolated 305 values in ThreadLocals
> > > >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > >> > INFO: END
> > > >> > Nov 03, 2013 10:12:48 AM
> > org.apache.activemq.ra.ActiveMQEndpointWorker
> > > >> stop
> > > >> > INFO: Stopping
> > > >> > Nov 03, 2013 10:12:48 AM
> > org.apache.activemq.ra.ActiveMQEndpointWorker
> > > >> stop
> > > >> > INFO: Stopping
> > > >> > [EL Info]: 2013-11-03
> > > >> >
> > > >> >
> > > >>
> > >
> >
> 10:12:48.682--ServerSession(1206174612)--file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/mcmsweb/WEB-INF/classes/_mcmsPU
> > > >> > logout successful
> > > >> > Nov 03, 2013 10:12:49 AM
> > org.apache.catalina.loader.WebappClassLoader
> > > >> > clearReferencesThreads
> > > >> > SEVERE: The web application [/mcmsweb] appears to have started a
> > > thread
> > > >> > named [PoolIdleReleaseTimer] but has failed to stop it. This is
> very
> > > >> likely
> > > >> > to create a memory leak.
> > > >> > Nov 03, 2013 10:12:49 AM
> > org.apache.catalina.loader.WebappClassLoader
> > > >> > clearReferencesThreads
> > > >> > SEVERE: The web application [/mcmsweb] appears to have started a
> > > thread
> > > >> > named [ActiveMQ VMTransport: vm://localhost#5-5] but has failed to
> > > stop
> > > >> it.
> > > >> > This is very likely to create a memory leak.
> > > >> > Nov 03, 2013 10:12:49 AM
> > org.apache.catalina.loader.WebappClassLoader
> > > >> > clearReferencesThreads
> > > >> > SEVERE: The web application [/mcmsweb] appears to have started a
> > > thread
> > > >> > named [ActiveMQ VMTransport: vm://localhost#5-6] but has failed to
> > > stop
> > > >> it.
> > > >> > This is very likely to create a memory leak.
> > > >> > Nov 03, 2013 10:12:49 AM
> > org.apache.catalina.loader.WebappClassLoader
> > > >> > clearReferencesThreads
> > > >> > SEVERE: The web application [/mcmsweb] appears to have started a
> > > thread
> > > >> > named [ActiveMQ VMTransport: vm://localhost#4-4] but has failed to
> > > stop
> > > >> it.
> > > >> > This is very likely to create a memory leak.
> > > >> > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> > > >> > INFO: Stopping ProtocolHandler ["http-nio-8080"]
> > > >> > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> > > >> > INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
> > > >> > Nov 03, 2013 10:12:57 AM
> > > org.apache.openejb.server.SimpleServiceManager
> > > >> > stop
> > > >> > INFO: Stopping server services
> > > >> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> > > >> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutting
> > > down.
> > > >> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler standby
> > > >> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB paused.
> > > >> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler
> > unregisterJMX
> > > >> > INFO: Scheduler unregistered from name
> > > >> >
> > > >> >
> > > >>
> > >
> >
> 'quartz:type=QuartzScheduler,name=OpenEJB-TimerService-Scheduler,instance=OpenEJB'
> > > >> > in the local MBeanServer.
> > > >> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> > > >> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutdown
> > > >> complete.
> > > >> > Nov 03, 2013 10:12:57 AM
> > > org.apache.openejb.assembler.classic.Assembler
> > > >> > destroyApplication
> > > >> > INFO: Undeploying app: openejb
> > > >> > Nov 03, 2013 10:12:57 AM
> > > org.apache.openejb.assembler.classic.Assembler
> > > >> > destroyResource
> > > >> > INFO: Closing DataSource: main
> > > >> > Nov 03, 2013 10:12:57 AM
> > > org.apache.openejb.assembler.classic.Assembler
> > > >> > destroyResource
> > > >> > INFO: Closing DataSource: fallback
> > > >> > Nov 03, 2013 10:12:57 AM
> > > org.apache.openejb.assembler.classic.Assembler
> > > >> > destroyResource
> > > >> > INFO: Stopping ResourceAdapter: Default JMS Resource Adapter
> > > >> > Nov 03, 2013 10:12:57 AM
> > > >> > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stop
> > > >> > INFO: Stopping ActiveMQ
> > > >> > Nov 03, 2013 10:12:58 AM
> > > >> > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter
> > stopImpl
> > > >> > INFO: Stopped ActiveMQ broker
> > > >> > Nov 03, 2013 10:12:58 AM
> > > org.apache.openejb.assembler.classic.Assembler
> > > >> > destroyResource
> > > >> > INFO: Closing DataSource: Default Unmanaged JDBC Database
> > > >> > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol
> destroy
> > > >> > INFO: Destroying ProtocolHandler ["http-nio-8080"]
> > > >> > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol
> destroy
> > > >> > INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
> > > >> >
> > > >> >
> > > >> >
> > > >> > On Sun, Nov 3, 2013 at 9:55 AM, Howard W. Smith, Jr. <
> > > >> > smithh032772@gmail.com
> > > >> > > wrote:
> > > >> >
> > > >> > > okay, i set it up as your post demonstrated, I tested already,
> > and I
> > > >> see
> > > >> > > no issues. it's time to test this in production. :)
> > > >> > >
> > > >> > > thanks romain! like i said in the other thread, I wish I knew
> > about
> > > >> this
> > > >> > > earlier.
> > > >> > >
> > > >> > >
> > > >> > >
> > > >> > > On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
> > > >> > > smithh032772@gmail.com> wrote:
> > > >> > >
> > > >> > >> So, the following replaces service-jar.xml (as per your post)?
> > > >> > >>
> > > >> > >> <Resource id="jdbc/ds" type="DataSource"
> > > provider="RoutedDataSource">
> > > >> > >>    router = failover-router
> > > >> > >> </Resource>
> > > >> > >>
> > > >> > >> and if I wanted to use the 'strategy' parameter, I would add to
> > > >> Resource
> > > >> > >> as demonstrated below?
> > > >> > >>
> > > >> > >> <Resource id="jdbc/ds" type="DataSource"
> > > provider="RoutedDataSource">
> > > >> > >>    router = failover-router
> > > >> > >>    strategy = random
> > > >> > >> </Resource>
> > > >> > >>
> > > >> > >>
> > > >> > >>
> > > >> > >>
> > > >> > >> On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <
> > > >> > rmannibucau@gmail.com
> > > >> > >> > wrote:
> > > >> > >>
> > > >> > >>> Hi
> > > >> > >>>
> > > >> > >>> Failover is native but to customiee the algo you can code
> > anything
> > > >> you
> > > >> > >>> want
> > > >> > >>>
> > > >> > >>> Tomee.xml is openejb.xml
> > > >> > >>>
> > > >> > >>> Service-jar.xml is today useless (see my post)
> > > >> > >>> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <
> > > smithh032772@gmail.com
> > > >> >
> > > >> > a
> > > >> > >>> écrit :
> > > >> > >>>
> > > >> > >>> > First of all, thanks Romain for recommending the following,
> > and
> > > for
> > > >> > >>> that I
> > > >> > >>> > will gladly start a new thread. :)
> > > >> > >>> >
> > > >> > >>> > TomEE/OpenEJB and failover of datasources[1]
> > > >> > >>> >
> > > >> > >>> > which references
> > > >> > >>> >
> > > >> > >>> > [OpenEJB] Dynamic Datasource[2]
> > > >> > >>> >
> > > >> > >>> > but I found the following  TomEE example:
> > > >> > >>> >
> > > >> > >>> > [TomEE] Dynamic Datasource Routing[3]
> > > >> > >>> >
> > > >> > >>> > So, before I begin, my questions are as follows:
> > > >> > >>> >
> > > >> > >>> > 1. I recognized that failover[1] says that the idea is to
> > > 'reuse'
> > > >> > >>> dynamic
> > > >> > >>> > datasource. Does this mean that we should code openejb[2] or
> > > >> tomee[3]
> > > >> > >>> > dynamic datasource, first, and then reference accordingly
> via
> > > >> > >>> failover[1]?
> > > >> > >>> >
> > > >> > >>> > 2. or failover[1] requires no coding on our part? only
> > developer
> > > >> > needs
> > > >> > >>> to
> > > >> > >>> > setup the failover 'config'?
> > > >> > >>> >
> > > >> > >>> > 3. also, tomee[3] dynamic datasource routing recommends
> > > openejb.xml
> > > >> > >>> > (instead of tomee.xml). can openejb.xml cofiguration be
> placed
> > > in
> > > >> > >>> > tomee.xml, too, or not?
> > > >> > >>> >
> > > >> > >>> > 4. okay, never mind, I was abouto ask for some clarification
> > > about
> > > >> > >>> > META-INF/org.router/service-jar.xml, but I 'found'
> > > service-jar.xml
> > > >> on
> > > >> > >>> > trunk[4]. :)
> > > >> > >>> >
> > > >> > >>> >
> > > >> > >>> >
> > > >> > >>> > [1]
> > > >> > >>> >
> > > >> > >>> >
> > > >> > >>>
> > > >> >
> > > >>
> > >
> >
> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
> > > >> > >>> >
> > > >> > >>> > [2] http://tomee.apache.org/dynamic-datasource.html
> > > >> > >>> >
> > > >> > >>> > [3]
> > > >> > >>> >
> > > >> > >>> >
> > > >> > >>>
> > > >> >
> > > >>
> > >
> >
> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
> > > >> > >>> >
> > > >> > >>> > [4]
> > > >> > >>> >
> > > >> > >>> >
> > > >> > >>>
> > > >> >
> > > >>
> > >
> >
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
> > > >> > >>> >
> > > >> > >>>
> > > >> > >>
> > > >> > >>
> > > >> > >
> > > >> >
> > > >>
> > >
> >
>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Failover is a facase over normal resources. Only these resource can/should
be pooled
Le 3 nov. 2013 21:51, "Howard W. Smith, Jr." <sm...@gmail.com> a
écrit :

> interesting. I can definitely use this as a reference if (ever) necessary,
> thanks.
>
> which brings me to my next question,
>
>         //
>         // take care next strategies can break multiple calls on the facade
>         // it is only intended to be used for connection selection
>         //
>
>
> I recognized that in the code. I know I make many calls to @Stateless @EJB
> facade objects to read/write data from/to database, and I also configured
> tomcat jdbc pool  to allow for many connections...in/via tomee.xml
> <Resource .../>.
>
> so, my question... what is the rule of thumb when configuring jdbc pool and
> tomee/openejb failover via dynamic datasources? on my development/test
> server, I have the following:
>
> <Resource id="jdbc/main" type="javax.sql.DataSource">
>   JdbcDriver org.apache.derby.jdbc.EmbeddedDriver
>   JdbcUrl jdbc:derby:C:/javadb/databases/mcmsdev;create=true
>   UserName ....
>   Password ....
>   JtaManaged true
>   jmxEnabled true
>   LogSql false
>   InitialSize 10
>   MaxActive 100
>   MaxIdle 30
>   MaxWait 10000
>   minIdle 10
>   suspectTimeout 60
>   removeAbandoned true
>   removeAbandonedTimeout 180
>   timeBetweenEvictionRunsMillis 30000
>   jdbcInterceptors=StatementCache(max=128)
> </Resource>
>
> <Resource id="jdbc/fallback" type="javax.sql.DataSource">
>   JdbcDriver org.apache.derby.jdbc.EmbeddedDriver
>   JdbcUrl jdbc:derby:C:/javadb/databases/mcms;create=true
>   UserName ....
>   Password ....
>   JtaManaged true
>   jmxEnabled true
>   LogSql false
>   InitialSize 10
>   MaxActive 100
>   MaxIdle 30
>   MaxWait 10000
>   minIdle 10
>   suspectTimeout 60
>   removeAbandoned true
>   removeAbandonedTimeout 180
>   timeBetweenEvictionRunsMillis 30000
>   jdbcInterceptors=StatementCache(max=128)
> </Resource>
>
> <Resource id="failover-router"
> class-name="org.apache.openejb.resource.jdbc.router.FailOverRouter">
>    datasourceNames = jdbc/main,jdbc/fallback
> </Resource>
>
> <Resource id="jdbc/mcmsJta" type="DataSource" provider="RoutedDataSource">
>   router = failover-router
> </Resource>
>
> should I be configuring tomcat jdbc pooling on the dynamic datasources, or
> on the routed datasource? also, I recognized something in the log file,
> since RoutedDataSource has no URL, the following shows up in the log when
> starting TomEE:
>
> INFO: Creating Resource(id=jdbc/mcmsJta)
> Nov 03, 2013 9:19:04 AM org.apache.openejb.assembler.classic.Assembler
> createResource
> INFO: can't find url for jdbc/mcmsJta will not monitor it
>
>
>
>
> On Sun, Nov 3, 2013 at 10:52 AM, Romain Manni-Bucau
> <rm...@gmail.com>wrote:
>
> >  lookhttp://
> >
> svn.apache.org/repos/asf/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/FailOverRouter.java
> > last method
> >
> > it can still be enhanced a lot
> > Romain Manni-Bucau
> > Twitter: @rmannibucau
> > Blog: http://rmannibucau.wordpress.com/
> > LinkedIn: http://fr.linkedin.com/in/rmannibucau
> > Github: https://github.com/rmannibucau
> >
> >
> >
> > 2013/11/3 Howard W. Smith, Jr. <sm...@gmail.com>:
> > > okay, and one last question, is there a bit more documentation on the
> > > following, so we can know what to expect, and the implementation is
> quite
> > > sound, working as designed and no known issues with the following?
> > >
> > > <ul>
> > > <li>default: the first is used while possible and others datasources
> are
> > > just backup, this is typically the failover case</li>
> > > <li>random: any datasource of the list is used</li>
> > > <li>reverse: between two call to a method the list is reversed</li>
> > > <li>round-robin[%N]: round robin between datasources, you can specify
> how
> > > many step you browse between two calls using N (default is 1)</li>
> > > </ul>
> > >
> > > i saw the limitations on the referenced pages (dynamic datasources),
> but
> > I
> > > didn't see any known issues in your/Romain's post/blog.
> > >
> > > please excuse my ignorance, if I have not heard or seen much chatter
> > about
> > > this on the mail list. I usually try to pay attention to almost all
> tomee
> > > emails, especially those that interest me the most. :)
> > >
> > >
> > >
> > >
> > > On Sun, Nov 3, 2013 at 10:22 AM, Romain Manni-Bucau
> > > <rm...@gmail.com>wrote:
> > >
> > >> If you dont use it then thats ok. We close the pool then, not
> > connections
> > >> Le 3 nov. 2013 16:19, "Howard W. Smith, Jr." <sm...@gmail.com>
> a
> > >> écrit :
> > >>
> > >> > FYI, I just stopped my local tomee, and recognized that my
> > @Application
> > >> > @PreDestroy has my code that stops Apache Derby prior to main and
> > >> fallback
> > >> > datasources are closed.
> > >> >
> > >> > is this okay?
> > >> >
> > >> > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardServer
> await
> > >> > INFO: A valid shutdown command was received via the shutdown port.
> > >> Stopping
> > >> > the Server instance.
> > >> > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> > >> > INFO: Pausing ProtocolHandler ["http-nio-8080"]
> > >> > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> > >> > INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
> > >> > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardService
> > >> > stopInternal
> > >> > INFO: Stopping service Catalina
> > >> > Nov 03, 2013 10:12:48 AM pf.LoginFilter destroy
> > >> > INFO: ...
> > >> > Nov 03, 2013 10:12:48 AM
> > org.apache.openejb.assembler.classic.Assembler
> > >> > destroyApplication
> > >> > INFO: Undeploying app:
> > >> C:\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\mcmsweb
> > >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > >> > INFO: BEGIN
> > >> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> > >> > INFO: DerbyUtil.java: shutdown() invoked
> > >> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil loadDriver
> > >> > INFO: DerbyUtil.java: loadDriver(): Loaded driver
> > >> > (org.apache.derby.jdbc.EmbeddedDriver) successfully
> > >> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> > >> > INFO: DerbyUtil.java: shutdown(): Derby shut down normally
> > >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > >> > INFO: gCalUtil.shutdown() completed
> > >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > >> > INFO: jodConverter.shutdown() completed
> > >> > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> > >> > INFO: ApplicationMessageBean.shutdown() BEGIN
> > >> > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> > >> > INFO: ApplicationMessageBean.shutdown() END
> > >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > >> > INFO: applicationMessageBean.shutdown() completed
> > >> > Nov 03, 2013 10:12:48 AM pf.ThreadLocalImmolater immolate
> > >> > INFO: immolated 305 values in ThreadLocals
> > >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > >> > INFO: END
> > >> > Nov 03, 2013 10:12:48 AM
> org.apache.activemq.ra.ActiveMQEndpointWorker
> > >> stop
> > >> > INFO: Stopping
> > >> > Nov 03, 2013 10:12:48 AM
> org.apache.activemq.ra.ActiveMQEndpointWorker
> > >> stop
> > >> > INFO: Stopping
> > >> > [EL Info]: 2013-11-03
> > >> >
> > >> >
> > >>
> >
> 10:12:48.682--ServerSession(1206174612)--file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/mcmsweb/WEB-INF/classes/_mcmsPU
> > >> > logout successful
> > >> > Nov 03, 2013 10:12:49 AM
> org.apache.catalina.loader.WebappClassLoader
> > >> > clearReferencesThreads
> > >> > SEVERE: The web application [/mcmsweb] appears to have started a
> > thread
> > >> > named [PoolIdleReleaseTimer] but has failed to stop it. This is very
> > >> likely
> > >> > to create a memory leak.
> > >> > Nov 03, 2013 10:12:49 AM
> org.apache.catalina.loader.WebappClassLoader
> > >> > clearReferencesThreads
> > >> > SEVERE: The web application [/mcmsweb] appears to have started a
> > thread
> > >> > named [ActiveMQ VMTransport: vm://localhost#5-5] but has failed to
> > stop
> > >> it.
> > >> > This is very likely to create a memory leak.
> > >> > Nov 03, 2013 10:12:49 AM
> org.apache.catalina.loader.WebappClassLoader
> > >> > clearReferencesThreads
> > >> > SEVERE: The web application [/mcmsweb] appears to have started a
> > thread
> > >> > named [ActiveMQ VMTransport: vm://localhost#5-6] but has failed to
> > stop
> > >> it.
> > >> > This is very likely to create a memory leak.
> > >> > Nov 03, 2013 10:12:49 AM
> org.apache.catalina.loader.WebappClassLoader
> > >> > clearReferencesThreads
> > >> > SEVERE: The web application [/mcmsweb] appears to have started a
> > thread
> > >> > named [ActiveMQ VMTransport: vm://localhost#4-4] but has failed to
> > stop
> > >> it.
> > >> > This is very likely to create a memory leak.
> > >> > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> > >> > INFO: Stopping ProtocolHandler ["http-nio-8080"]
> > >> > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> > >> > INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
> > >> > Nov 03, 2013 10:12:57 AM
> > org.apache.openejb.server.SimpleServiceManager
> > >> > stop
> > >> > INFO: Stopping server services
> > >> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> > >> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutting
> > down.
> > >> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler standby
> > >> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB paused.
> > >> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler
> unregisterJMX
> > >> > INFO: Scheduler unregistered from name
> > >> >
> > >> >
> > >>
> >
> 'quartz:type=QuartzScheduler,name=OpenEJB-TimerService-Scheduler,instance=OpenEJB'
> > >> > in the local MBeanServer.
> > >> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> > >> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutdown
> > >> complete.
> > >> > Nov 03, 2013 10:12:57 AM
> > org.apache.openejb.assembler.classic.Assembler
> > >> > destroyApplication
> > >> > INFO: Undeploying app: openejb
> > >> > Nov 03, 2013 10:12:57 AM
> > org.apache.openejb.assembler.classic.Assembler
> > >> > destroyResource
> > >> > INFO: Closing DataSource: main
> > >> > Nov 03, 2013 10:12:57 AM
> > org.apache.openejb.assembler.classic.Assembler
> > >> > destroyResource
> > >> > INFO: Closing DataSource: fallback
> > >> > Nov 03, 2013 10:12:57 AM
> > org.apache.openejb.assembler.classic.Assembler
> > >> > destroyResource
> > >> > INFO: Stopping ResourceAdapter: Default JMS Resource Adapter
> > >> > Nov 03, 2013 10:12:57 AM
> > >> > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stop
> > >> > INFO: Stopping ActiveMQ
> > >> > Nov 03, 2013 10:12:58 AM
> > >> > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter
> stopImpl
> > >> > INFO: Stopped ActiveMQ broker
> > >> > Nov 03, 2013 10:12:58 AM
> > org.apache.openejb.assembler.classic.Assembler
> > >> > destroyResource
> > >> > INFO: Closing DataSource: Default Unmanaged JDBC Database
> > >> > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> > >> > INFO: Destroying ProtocolHandler ["http-nio-8080"]
> > >> > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> > >> > INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
> > >> >
> > >> >
> > >> >
> > >> > On Sun, Nov 3, 2013 at 9:55 AM, Howard W. Smith, Jr. <
> > >> > smithh032772@gmail.com
> > >> > > wrote:
> > >> >
> > >> > > okay, i set it up as your post demonstrated, I tested already,
> and I
> > >> see
> > >> > > no issues. it's time to test this in production. :)
> > >> > >
> > >> > > thanks romain! like i said in the other thread, I wish I knew
> about
> > >> this
> > >> > > earlier.
> > >> > >
> > >> > >
> > >> > >
> > >> > > On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
> > >> > > smithh032772@gmail.com> wrote:
> > >> > >
> > >> > >> So, the following replaces service-jar.xml (as per your post)?
> > >> > >>
> > >> > >> <Resource id="jdbc/ds" type="DataSource"
> > provider="RoutedDataSource">
> > >> > >>    router = failover-router
> > >> > >> </Resource>
> > >> > >>
> > >> > >> and if I wanted to use the 'strategy' parameter, I would add to
> > >> Resource
> > >> > >> as demonstrated below?
> > >> > >>
> > >> > >> <Resource id="jdbc/ds" type="DataSource"
> > provider="RoutedDataSource">
> > >> > >>    router = failover-router
> > >> > >>    strategy = random
> > >> > >> </Resource>
> > >> > >>
> > >> > >>
> > >> > >>
> > >> > >>
> > >> > >> On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <
> > >> > rmannibucau@gmail.com
> > >> > >> > wrote:
> > >> > >>
> > >> > >>> Hi
> > >> > >>>
> > >> > >>> Failover is native but to customiee the algo you can code
> anything
> > >> you
> > >> > >>> want
> > >> > >>>
> > >> > >>> Tomee.xml is openejb.xml
> > >> > >>>
> > >> > >>> Service-jar.xml is today useless (see my post)
> > >> > >>> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <
> > smithh032772@gmail.com
> > >> >
> > >> > a
> > >> > >>> écrit :
> > >> > >>>
> > >> > >>> > First of all, thanks Romain for recommending the following,
> and
> > for
> > >> > >>> that I
> > >> > >>> > will gladly start a new thread. :)
> > >> > >>> >
> > >> > >>> > TomEE/OpenEJB and failover of datasources[1]
> > >> > >>> >
> > >> > >>> > which references
> > >> > >>> >
> > >> > >>> > [OpenEJB] Dynamic Datasource[2]
> > >> > >>> >
> > >> > >>> > but I found the following  TomEE example:
> > >> > >>> >
> > >> > >>> > [TomEE] Dynamic Datasource Routing[3]
> > >> > >>> >
> > >> > >>> > So, before I begin, my questions are as follows:
> > >> > >>> >
> > >> > >>> > 1. I recognized that failover[1] says that the idea is to
> > 'reuse'
> > >> > >>> dynamic
> > >> > >>> > datasource. Does this mean that we should code openejb[2] or
> > >> tomee[3]
> > >> > >>> > dynamic datasource, first, and then reference accordingly via
> > >> > >>> failover[1]?
> > >> > >>> >
> > >> > >>> > 2. or failover[1] requires no coding on our part? only
> developer
> > >> > needs
> > >> > >>> to
> > >> > >>> > setup the failover 'config'?
> > >> > >>> >
> > >> > >>> > 3. also, tomee[3] dynamic datasource routing recommends
> > openejb.xml
> > >> > >>> > (instead of tomee.xml). can openejb.xml cofiguration be placed
> > in
> > >> > >>> > tomee.xml, too, or not?
> > >> > >>> >
> > >> > >>> > 4. okay, never mind, I was abouto ask for some clarification
> > about
> > >> > >>> > META-INF/org.router/service-jar.xml, but I 'found'
> > service-jar.xml
> > >> on
> > >> > >>> > trunk[4]. :)
> > >> > >>> >
> > >> > >>> >
> > >> > >>> >
> > >> > >>> > [1]
> > >> > >>> >
> > >> > >>> >
> > >> > >>>
> > >> >
> > >>
> >
> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
> > >> > >>> >
> > >> > >>> > [2] http://tomee.apache.org/dynamic-datasource.html
> > >> > >>> >
> > >> > >>> > [3]
> > >> > >>> >
> > >> > >>> >
> > >> > >>>
> > >> >
> > >>
> >
> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
> > >> > >>> >
> > >> > >>> > [4]
> > >> > >>> >
> > >> > >>> >
> > >> > >>>
> > >> >
> > >>
> >
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
> > >> > >>> >
> > >> > >>>
> > >> > >>
> > >> > >>
> > >> > >
> > >> >
> > >>
> >
>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
interesting. I can definitely use this as a reference if (ever) necessary,
thanks.

which brings me to my next question,

        //
        // take care next strategies can break multiple calls on the facade
        // it is only intended to be used for connection selection
        //


I recognized that in the code. I know I make many calls to @Stateless @EJB
facade objects to read/write data from/to database, and I also configured
tomcat jdbc pool  to allow for many connections...in/via tomee.xml
<Resource .../>.

so, my question... what is the rule of thumb when configuring jdbc pool and
tomee/openejb failover via dynamic datasources? on my development/test
server, I have the following:

<Resource id="jdbc/main" type="javax.sql.DataSource">
  JdbcDriver org.apache.derby.jdbc.EmbeddedDriver
  JdbcUrl jdbc:derby:C:/javadb/databases/mcmsdev;create=true
  UserName ....
  Password ....
  JtaManaged true
  jmxEnabled true
  LogSql false
  InitialSize 10
  MaxActive 100
  MaxIdle 30
  MaxWait 10000
  minIdle 10
  suspectTimeout 60
  removeAbandoned true
  removeAbandonedTimeout 180
  timeBetweenEvictionRunsMillis 30000
  jdbcInterceptors=StatementCache(max=128)
</Resource>

<Resource id="jdbc/fallback" type="javax.sql.DataSource">
  JdbcDriver org.apache.derby.jdbc.EmbeddedDriver
  JdbcUrl jdbc:derby:C:/javadb/databases/mcms;create=true
  UserName ....
  Password ....
  JtaManaged true
  jmxEnabled true
  LogSql false
  InitialSize 10
  MaxActive 100
  MaxIdle 30
  MaxWait 10000
  minIdle 10
  suspectTimeout 60
  removeAbandoned true
  removeAbandonedTimeout 180
  timeBetweenEvictionRunsMillis 30000
  jdbcInterceptors=StatementCache(max=128)
</Resource>

<Resource id="failover-router"
class-name="org.apache.openejb.resource.jdbc.router.FailOverRouter">
   datasourceNames = jdbc/main,jdbc/fallback
</Resource>

<Resource id="jdbc/mcmsJta" type="DataSource" provider="RoutedDataSource">
  router = failover-router
</Resource>

should I be configuring tomcat jdbc pooling on the dynamic datasources, or
on the routed datasource? also, I recognized something in the log file,
since RoutedDataSource has no URL, the following shows up in the log when
starting TomEE:

INFO: Creating Resource(id=jdbc/mcmsJta)
Nov 03, 2013 9:19:04 AM org.apache.openejb.assembler.classic.Assembler
createResource
INFO: can't find url for jdbc/mcmsJta will not monitor it




On Sun, Nov 3, 2013 at 10:52 AM, Romain Manni-Bucau
<rm...@gmail.com>wrote:

>  lookhttp://
> svn.apache.org/repos/asf/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/FailOverRouter.java
> last method
>
> it can still be enhanced a lot
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
>
> 2013/11/3 Howard W. Smith, Jr. <sm...@gmail.com>:
> > okay, and one last question, is there a bit more documentation on the
> > following, so we can know what to expect, and the implementation is quite
> > sound, working as designed and no known issues with the following?
> >
> > <ul>
> > <li>default: the first is used while possible and others datasources are
> > just backup, this is typically the failover case</li>
> > <li>random: any datasource of the list is used</li>
> > <li>reverse: between two call to a method the list is reversed</li>
> > <li>round-robin[%N]: round robin between datasources, you can specify how
> > many step you browse between two calls using N (default is 1)</li>
> > </ul>
> >
> > i saw the limitations on the referenced pages (dynamic datasources), but
> I
> > didn't see any known issues in your/Romain's post/blog.
> >
> > please excuse my ignorance, if I have not heard or seen much chatter
> about
> > this on the mail list. I usually try to pay attention to almost all tomee
> > emails, especially those that interest me the most. :)
> >
> >
> >
> >
> > On Sun, Nov 3, 2013 at 10:22 AM, Romain Manni-Bucau
> > <rm...@gmail.com>wrote:
> >
> >> If you dont use it then thats ok. We close the pool then, not
> connections
> >> Le 3 nov. 2013 16:19, "Howard W. Smith, Jr." <sm...@gmail.com> a
> >> écrit :
> >>
> >> > FYI, I just stopped my local tomee, and recognized that my
> @Application
> >> > @PreDestroy has my code that stops Apache Derby prior to main and
> >> fallback
> >> > datasources are closed.
> >> >
> >> > is this okay?
> >> >
> >> > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardServer await
> >> > INFO: A valid shutdown command was received via the shutdown port.
> >> Stopping
> >> > the Server instance.
> >> > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> >> > INFO: Pausing ProtocolHandler ["http-nio-8080"]
> >> > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> >> > INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
> >> > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardService
> >> > stopInternal
> >> > INFO: Stopping service Catalina
> >> > Nov 03, 2013 10:12:48 AM pf.LoginFilter destroy
> >> > INFO: ...
> >> > Nov 03, 2013 10:12:48 AM
> org.apache.openejb.assembler.classic.Assembler
> >> > destroyApplication
> >> > INFO: Undeploying app:
> >> C:\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\mcmsweb
> >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> >> > INFO: BEGIN
> >> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> >> > INFO: DerbyUtil.java: shutdown() invoked
> >> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil loadDriver
> >> > INFO: DerbyUtil.java: loadDriver(): Loaded driver
> >> > (org.apache.derby.jdbc.EmbeddedDriver) successfully
> >> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> >> > INFO: DerbyUtil.java: shutdown(): Derby shut down normally
> >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> >> > INFO: gCalUtil.shutdown() completed
> >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> >> > INFO: jodConverter.shutdown() completed
> >> > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> >> > INFO: ApplicationMessageBean.shutdown() BEGIN
> >> > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> >> > INFO: ApplicationMessageBean.shutdown() END
> >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> >> > INFO: applicationMessageBean.shutdown() completed
> >> > Nov 03, 2013 10:12:48 AM pf.ThreadLocalImmolater immolate
> >> > INFO: immolated 305 values in ThreadLocals
> >> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> >> > INFO: END
> >> > Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker
> >> stop
> >> > INFO: Stopping
> >> > Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker
> >> stop
> >> > INFO: Stopping
> >> > [EL Info]: 2013-11-03
> >> >
> >> >
> >>
> 10:12:48.682--ServerSession(1206174612)--file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/mcmsweb/WEB-INF/classes/_mcmsPU
> >> > logout successful
> >> > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> >> > clearReferencesThreads
> >> > SEVERE: The web application [/mcmsweb] appears to have started a
> thread
> >> > named [PoolIdleReleaseTimer] but has failed to stop it. This is very
> >> likely
> >> > to create a memory leak.
> >> > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> >> > clearReferencesThreads
> >> > SEVERE: The web application [/mcmsweb] appears to have started a
> thread
> >> > named [ActiveMQ VMTransport: vm://localhost#5-5] but has failed to
> stop
> >> it.
> >> > This is very likely to create a memory leak.
> >> > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> >> > clearReferencesThreads
> >> > SEVERE: The web application [/mcmsweb] appears to have started a
> thread
> >> > named [ActiveMQ VMTransport: vm://localhost#5-6] but has failed to
> stop
> >> it.
> >> > This is very likely to create a memory leak.
> >> > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> >> > clearReferencesThreads
> >> > SEVERE: The web application [/mcmsweb] appears to have started a
> thread
> >> > named [ActiveMQ VMTransport: vm://localhost#4-4] but has failed to
> stop
> >> it.
> >> > This is very likely to create a memory leak.
> >> > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> >> > INFO: Stopping ProtocolHandler ["http-nio-8080"]
> >> > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> >> > INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
> >> > Nov 03, 2013 10:12:57 AM
> org.apache.openejb.server.SimpleServiceManager
> >> > stop
> >> > INFO: Stopping server services
> >> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> >> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutting
> down.
> >> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler standby
> >> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB paused.
> >> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler unregisterJMX
> >> > INFO: Scheduler unregistered from name
> >> >
> >> >
> >>
> 'quartz:type=QuartzScheduler,name=OpenEJB-TimerService-Scheduler,instance=OpenEJB'
> >> > in the local MBeanServer.
> >> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> >> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutdown
> >> complete.
> >> > Nov 03, 2013 10:12:57 AM
> org.apache.openejb.assembler.classic.Assembler
> >> > destroyApplication
> >> > INFO: Undeploying app: openejb
> >> > Nov 03, 2013 10:12:57 AM
> org.apache.openejb.assembler.classic.Assembler
> >> > destroyResource
> >> > INFO: Closing DataSource: main
> >> > Nov 03, 2013 10:12:57 AM
> org.apache.openejb.assembler.classic.Assembler
> >> > destroyResource
> >> > INFO: Closing DataSource: fallback
> >> > Nov 03, 2013 10:12:57 AM
> org.apache.openejb.assembler.classic.Assembler
> >> > destroyResource
> >> > INFO: Stopping ResourceAdapter: Default JMS Resource Adapter
> >> > Nov 03, 2013 10:12:57 AM
> >> > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stop
> >> > INFO: Stopping ActiveMQ
> >> > Nov 03, 2013 10:12:58 AM
> >> > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stopImpl
> >> > INFO: Stopped ActiveMQ broker
> >> > Nov 03, 2013 10:12:58 AM
> org.apache.openejb.assembler.classic.Assembler
> >> > destroyResource
> >> > INFO: Closing DataSource: Default Unmanaged JDBC Database
> >> > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> >> > INFO: Destroying ProtocolHandler ["http-nio-8080"]
> >> > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> >> > INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
> >> >
> >> >
> >> >
> >> > On Sun, Nov 3, 2013 at 9:55 AM, Howard W. Smith, Jr. <
> >> > smithh032772@gmail.com
> >> > > wrote:
> >> >
> >> > > okay, i set it up as your post demonstrated, I tested already, and I
> >> see
> >> > > no issues. it's time to test this in production. :)
> >> > >
> >> > > thanks romain! like i said in the other thread, I wish I knew about
> >> this
> >> > > earlier.
> >> > >
> >> > >
> >> > >
> >> > > On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
> >> > > smithh032772@gmail.com> wrote:
> >> > >
> >> > >> So, the following replaces service-jar.xml (as per your post)?
> >> > >>
> >> > >> <Resource id="jdbc/ds" type="DataSource"
> provider="RoutedDataSource">
> >> > >>    router = failover-router
> >> > >> </Resource>
> >> > >>
> >> > >> and if I wanted to use the 'strategy' parameter, I would add to
> >> Resource
> >> > >> as demonstrated below?
> >> > >>
> >> > >> <Resource id="jdbc/ds" type="DataSource"
> provider="RoutedDataSource">
> >> > >>    router = failover-router
> >> > >>    strategy = random
> >> > >> </Resource>
> >> > >>
> >> > >>
> >> > >>
> >> > >>
> >> > >> On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <
> >> > rmannibucau@gmail.com
> >> > >> > wrote:
> >> > >>
> >> > >>> Hi
> >> > >>>
> >> > >>> Failover is native but to customiee the algo you can code anything
> >> you
> >> > >>> want
> >> > >>>
> >> > >>> Tomee.xml is openejb.xml
> >> > >>>
> >> > >>> Service-jar.xml is today useless (see my post)
> >> > >>> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <
> smithh032772@gmail.com
> >> >
> >> > a
> >> > >>> écrit :
> >> > >>>
> >> > >>> > First of all, thanks Romain for recommending the following, and
> for
> >> > >>> that I
> >> > >>> > will gladly start a new thread. :)
> >> > >>> >
> >> > >>> > TomEE/OpenEJB and failover of datasources[1]
> >> > >>> >
> >> > >>> > which references
> >> > >>> >
> >> > >>> > [OpenEJB] Dynamic Datasource[2]
> >> > >>> >
> >> > >>> > but I found the following  TomEE example:
> >> > >>> >
> >> > >>> > [TomEE] Dynamic Datasource Routing[3]
> >> > >>> >
> >> > >>> > So, before I begin, my questions are as follows:
> >> > >>> >
> >> > >>> > 1. I recognized that failover[1] says that the idea is to
> 'reuse'
> >> > >>> dynamic
> >> > >>> > datasource. Does this mean that we should code openejb[2] or
> >> tomee[3]
> >> > >>> > dynamic datasource, first, and then reference accordingly via
> >> > >>> failover[1]?
> >> > >>> >
> >> > >>> > 2. or failover[1] requires no coding on our part? only developer
> >> > needs
> >> > >>> to
> >> > >>> > setup the failover 'config'?
> >> > >>> >
> >> > >>> > 3. also, tomee[3] dynamic datasource routing recommends
> openejb.xml
> >> > >>> > (instead of tomee.xml). can openejb.xml cofiguration be placed
> in
> >> > >>> > tomee.xml, too, or not?
> >> > >>> >
> >> > >>> > 4. okay, never mind, I was abouto ask for some clarification
> about
> >> > >>> > META-INF/org.router/service-jar.xml, but I 'found'
> service-jar.xml
> >> on
> >> > >>> > trunk[4]. :)
> >> > >>> >
> >> > >>> >
> >> > >>> >
> >> > >>> > [1]
> >> > >>> >
> >> > >>> >
> >> > >>>
> >> >
> >>
> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
> >> > >>> >
> >> > >>> > [2] http://tomee.apache.org/dynamic-datasource.html
> >> > >>> >
> >> > >>> > [3]
> >> > >>> >
> >> > >>> >
> >> > >>>
> >> >
> >>
> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
> >> > >>> >
> >> > >>> > [4]
> >> > >>> >
> >> > >>> >
> >> > >>>
> >> >
> >>
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
> >> > >>> >
> >> > >>>
> >> > >>
> >> > >>
> >> > >
> >> >
> >>
>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by Romain Manni-Bucau <rm...@gmail.com>.
 lookhttp://svn.apache.org/repos/asf/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/FailOverRouter.java
last method

it can still be enhanced a lot
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2013/11/3 Howard W. Smith, Jr. <sm...@gmail.com>:
> okay, and one last question, is there a bit more documentation on the
> following, so we can know what to expect, and the implementation is quite
> sound, working as designed and no known issues with the following?
>
> <ul>
> <li>default: the first is used while possible and others datasources are
> just backup, this is typically the failover case</li>
> <li>random: any datasource of the list is used</li>
> <li>reverse: between two call to a method the list is reversed</li>
> <li>round-robin[%N]: round robin between datasources, you can specify how
> many step you browse between two calls using N (default is 1)</li>
> </ul>
>
> i saw the limitations on the referenced pages (dynamic datasources), but I
> didn't see any known issues in your/Romain's post/blog.
>
> please excuse my ignorance, if I have not heard or seen much chatter about
> this on the mail list. I usually try to pay attention to almost all tomee
> emails, especially those that interest me the most. :)
>
>
>
>
> On Sun, Nov 3, 2013 at 10:22 AM, Romain Manni-Bucau
> <rm...@gmail.com>wrote:
>
>> If you dont use it then thats ok. We close the pool then, not connections
>> Le 3 nov. 2013 16:19, "Howard W. Smith, Jr." <sm...@gmail.com> a
>> écrit :
>>
>> > FYI, I just stopped my local tomee, and recognized that my @Application
>> > @PreDestroy has my code that stops Apache Derby prior to main and
>> fallback
>> > datasources are closed.
>> >
>> > is this okay?
>> >
>> > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardServer await
>> > INFO: A valid shutdown command was received via the shutdown port.
>> Stopping
>> > the Server instance.
>> > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
>> > INFO: Pausing ProtocolHandler ["http-nio-8080"]
>> > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
>> > INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
>> > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardService
>> > stopInternal
>> > INFO: Stopping service Catalina
>> > Nov 03, 2013 10:12:48 AM pf.LoginFilter destroy
>> > INFO: ...
>> > Nov 03, 2013 10:12:48 AM org.apache.openejb.assembler.classic.Assembler
>> > destroyApplication
>> > INFO: Undeploying app:
>> C:\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\mcmsweb
>> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
>> > INFO: BEGIN
>> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
>> > INFO: DerbyUtil.java: shutdown() invoked
>> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil loadDriver
>> > INFO: DerbyUtil.java: loadDriver(): Loaded driver
>> > (org.apache.derby.jdbc.EmbeddedDriver) successfully
>> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
>> > INFO: DerbyUtil.java: shutdown(): Derby shut down normally
>> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
>> > INFO: gCalUtil.shutdown() completed
>> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
>> > INFO: jodConverter.shutdown() completed
>> > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
>> > INFO: ApplicationMessageBean.shutdown() BEGIN
>> > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
>> > INFO: ApplicationMessageBean.shutdown() END
>> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
>> > INFO: applicationMessageBean.shutdown() completed
>> > Nov 03, 2013 10:12:48 AM pf.ThreadLocalImmolater immolate
>> > INFO: immolated 305 values in ThreadLocals
>> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
>> > INFO: END
>> > Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker
>> stop
>> > INFO: Stopping
>> > Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker
>> stop
>> > INFO: Stopping
>> > [EL Info]: 2013-11-03
>> >
>> >
>> 10:12:48.682--ServerSession(1206174612)--file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/mcmsweb/WEB-INF/classes/_mcmsPU
>> > logout successful
>> > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
>> > clearReferencesThreads
>> > SEVERE: The web application [/mcmsweb] appears to have started a thread
>> > named [PoolIdleReleaseTimer] but has failed to stop it. This is very
>> likely
>> > to create a memory leak.
>> > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
>> > clearReferencesThreads
>> > SEVERE: The web application [/mcmsweb] appears to have started a thread
>> > named [ActiveMQ VMTransport: vm://localhost#5-5] but has failed to stop
>> it.
>> > This is very likely to create a memory leak.
>> > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
>> > clearReferencesThreads
>> > SEVERE: The web application [/mcmsweb] appears to have started a thread
>> > named [ActiveMQ VMTransport: vm://localhost#5-6] but has failed to stop
>> it.
>> > This is very likely to create a memory leak.
>> > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
>> > clearReferencesThreads
>> > SEVERE: The web application [/mcmsweb] appears to have started a thread
>> > named [ActiveMQ VMTransport: vm://localhost#4-4] but has failed to stop
>> it.
>> > This is very likely to create a memory leak.
>> > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
>> > INFO: Stopping ProtocolHandler ["http-nio-8080"]
>> > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
>> > INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
>> > Nov 03, 2013 10:12:57 AM org.apache.openejb.server.SimpleServiceManager
>> > stop
>> > INFO: Stopping server services
>> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
>> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutting down.
>> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler standby
>> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB paused.
>> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler unregisterJMX
>> > INFO: Scheduler unregistered from name
>> >
>> >
>> 'quartz:type=QuartzScheduler,name=OpenEJB-TimerService-Scheduler,instance=OpenEJB'
>> > in the local MBeanServer.
>> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
>> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutdown
>> complete.
>> > Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
>> > destroyApplication
>> > INFO: Undeploying app: openejb
>> > Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
>> > destroyResource
>> > INFO: Closing DataSource: main
>> > Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
>> > destroyResource
>> > INFO: Closing DataSource: fallback
>> > Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
>> > destroyResource
>> > INFO: Stopping ResourceAdapter: Default JMS Resource Adapter
>> > Nov 03, 2013 10:12:57 AM
>> > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stop
>> > INFO: Stopping ActiveMQ
>> > Nov 03, 2013 10:12:58 AM
>> > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stopImpl
>> > INFO: Stopped ActiveMQ broker
>> > Nov 03, 2013 10:12:58 AM org.apache.openejb.assembler.classic.Assembler
>> > destroyResource
>> > INFO: Closing DataSource: Default Unmanaged JDBC Database
>> > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
>> > INFO: Destroying ProtocolHandler ["http-nio-8080"]
>> > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
>> > INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
>> >
>> >
>> >
>> > On Sun, Nov 3, 2013 at 9:55 AM, Howard W. Smith, Jr. <
>> > smithh032772@gmail.com
>> > > wrote:
>> >
>> > > okay, i set it up as your post demonstrated, I tested already, and I
>> see
>> > > no issues. it's time to test this in production. :)
>> > >
>> > > thanks romain! like i said in the other thread, I wish I knew about
>> this
>> > > earlier.
>> > >
>> > >
>> > >
>> > > On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
>> > > smithh032772@gmail.com> wrote:
>> > >
>> > >> So, the following replaces service-jar.xml (as per your post)?
>> > >>
>> > >> <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
>> > >>    router = failover-router
>> > >> </Resource>
>> > >>
>> > >> and if I wanted to use the 'strategy' parameter, I would add to
>> Resource
>> > >> as demonstrated below?
>> > >>
>> > >> <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
>> > >>    router = failover-router
>> > >>    strategy = random
>> > >> </Resource>
>> > >>
>> > >>
>> > >>
>> > >>
>> > >> On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <
>> > rmannibucau@gmail.com
>> > >> > wrote:
>> > >>
>> > >>> Hi
>> > >>>
>> > >>> Failover is native but to customiee the algo you can code anything
>> you
>> > >>> want
>> > >>>
>> > >>> Tomee.xml is openejb.xml
>> > >>>
>> > >>> Service-jar.xml is today useless (see my post)
>> > >>> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <smithh032772@gmail.com
>> >
>> > a
>> > >>> écrit :
>> > >>>
>> > >>> > First of all, thanks Romain for recommending the following, and for
>> > >>> that I
>> > >>> > will gladly start a new thread. :)
>> > >>> >
>> > >>> > TomEE/OpenEJB and failover of datasources[1]
>> > >>> >
>> > >>> > which references
>> > >>> >
>> > >>> > [OpenEJB] Dynamic Datasource[2]
>> > >>> >
>> > >>> > but I found the following  TomEE example:
>> > >>> >
>> > >>> > [TomEE] Dynamic Datasource Routing[3]
>> > >>> >
>> > >>> > So, before I begin, my questions are as follows:
>> > >>> >
>> > >>> > 1. I recognized that failover[1] says that the idea is to 'reuse'
>> > >>> dynamic
>> > >>> > datasource. Does this mean that we should code openejb[2] or
>> tomee[3]
>> > >>> > dynamic datasource, first, and then reference accordingly via
>> > >>> failover[1]?
>> > >>> >
>> > >>> > 2. or failover[1] requires no coding on our part? only developer
>> > needs
>> > >>> to
>> > >>> > setup the failover 'config'?
>> > >>> >
>> > >>> > 3. also, tomee[3] dynamic datasource routing recommends openejb.xml
>> > >>> > (instead of tomee.xml). can openejb.xml cofiguration be placed in
>> > >>> > tomee.xml, too, or not?
>> > >>> >
>> > >>> > 4. okay, never mind, I was abouto ask for some clarification about
>> > >>> > META-INF/org.router/service-jar.xml, but I 'found' service-jar.xml
>> on
>> > >>> > trunk[4]. :)
>> > >>> >
>> > >>> >
>> > >>> >
>> > >>> > [1]
>> > >>> >
>> > >>> >
>> > >>>
>> >
>> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
>> > >>> >
>> > >>> > [2] http://tomee.apache.org/dynamic-datasource.html
>> > >>> >
>> > >>> > [3]
>> > >>> >
>> > >>> >
>> > >>>
>> >
>> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
>> > >>> >
>> > >>> > [4]
>> > >>> >
>> > >>> >
>> > >>>
>> >
>> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
>> > >>> >
>> > >>>
>> > >>
>> > >>
>> > >
>> >
>>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Interesting. thanks Jean-Louis. Let me share some things.

When I saw Romain's response on the other thread that informed me about
tomee/openejb failover via dynamic datasource(s), I saw his post/blog
mention load-balancing, and that is what attracted me the most to this
feature.

So, after I added it to my tomee.xml (earlier this morning, my time), I
wanted to test the 'load-balancing' just a bit, I started a long-running
query that searches multiple tables for a certain string (varchar type),

and after starting that query, I did a multiple-table commit of at least 4
rows in an 'orders' table that is related to many other tables. the commit
consists of doing non-read-only queries that read 'orders' and the multiple
tables, and then copies the data (or insert the data into multiple tables).

i was quite impressed that the commit took less than 2 seconds maybe (on my
development server), which is not as fast as my production server, and
plus, my drive is drastically fragmented, since I have been doing JSF web
app development for 2 years straight, building building building and have
not defragged or reformatted (or replaced) my hard drive...

the commit occurred during the long-running query, and the query finished
some # of seconds after I was mouth-wide-opened (shocked) at the fact that
the data committed 'during' the long-running query.

but you know what? what was more even a shock to me was this...

all of the above was on my test/development server (locally here at my
home), so before updating production server (at another location), I
decided to login to production app, and run the same test. please
note/remember, production app was 'not' configured to use tomee/openejb
failover via dynamic datasource(s).

when I ran the same test, while connected (remotely) to the production app,
the test results were...exactly the same. that was very shocking. that is
why my earlier response... that it works... i was not so 'excited' as I am
'usually'.

lol...please continue to listen... i had wrote a very shocking email, and
was very excited to report that the 1st test (on development server) was
very impressive, but then after I ran the same test (remotely) against the
production server (that does not have tomee failover), I backspace'd my
response, and changed my response to a less-excited tone.

i know that i have strived to make my app perform well, and I just want the
database to not be the bottleneck in the app.

after performing the remote test against production server, I went ahead
and configured tomee/openejb failover via dynamic datasources on the
production server (in tomee.xml), and copied the database, once, so now the
app is connected to 2 databases. I want to test tomee/openejb failover via
dynamic datasources by running it...in production, on production server,
and see what the test results will be.

can/shall i assume that this is a form of replication? Jean-Louis, you
mentioned something like it targets the readonly requirement and I think
you said transactions are not shared. i assume the data is replicated
somehow. right?

thanks for listening and responding. :)



On Sun, Nov 3, 2013 at 10:51 AM, Jean-Louis MONTEIRO <je...@gmail.com>wrote:

> Well, we pushed that feature some years ago already.
> We mainly used it to implement a failover mechanism, or to implement kinda
> cloud features, I mean having each customer data in different databases.
> Also the read mostly pattern AFAIR.
>
> Restrictions are mainly transactions not shared and not wrapping
> connections from more than one datasource.
> The cache configuration must be well configured to not cache stale data.
> But it clearly depends on the use case.
>
> Hope that helps.
>
> JLouis
>
>
> 2013/11/3 Howard W. Smith, Jr. <sm...@gmail.com>
>
> > okay, and one last question, is there a bit more documentation on the
> > following, so we can know what to expect, and the implementation is quite
> > sound, working as designed and no known issues with the following?
> >
> > <ul>
> > <li>default: the first is used while possible and others datasources are
> > just backup, this is typically the failover case</li>
> > <li>random: any datasource of the list is used</li>
> > <li>reverse: between two call to a method the list is reversed</li>
> > <li>round-robin[%N]: round robin between datasources, you can specify how
> > many step you browse between two calls using N (default is 1)</li>
> > </ul>
> >
> > i saw the limitations on the referenced pages (dynamic datasources), but
> I
> > didn't see any known issues in your/Romain's post/blog.
> >
> > please excuse my ignorance, if I have not heard or seen much chatter
> about
> > this on the mail list. I usually try to pay attention to almost all tomee
> > emails, especially those that interest me the most. :)
> >
> >
> >
> >
> > On Sun, Nov 3, 2013 at 10:22 AM, Romain Manni-Bucau
> > <rm...@gmail.com>wrote:
> >
> > > If you dont use it then thats ok. We close the pool then, not
> connections
> > > Le 3 nov. 2013 16:19, "Howard W. Smith, Jr." <sm...@gmail.com>
> a
> > > écrit :
> > >
> > > > FYI, I just stopped my local tomee, and recognized that my
> @Application
> > > > @PreDestroy has my code that stops Apache Derby prior to main and
> > > fallback
> > > > datasources are closed.
> > > >
> > > > is this okay?
> > > >
> > > > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardServer
> await
> > > > INFO: A valid shutdown command was received via the shutdown port.
> > > Stopping
> > > > the Server instance.
> > > > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> > > > INFO: Pausing ProtocolHandler ["http-nio-8080"]
> > > > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> > > > INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
> > > > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardService
> > > > stopInternal
> > > > INFO: Stopping service Catalina
> > > > Nov 03, 2013 10:12:48 AM pf.LoginFilter destroy
> > > > INFO: ...
> > > > Nov 03, 2013 10:12:48 AM
> org.apache.openejb.assembler.classic.Assembler
> > > > destroyApplication
> > > > INFO: Undeploying app:
> > > C:\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\mcmsweb
> > > > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > > INFO: BEGIN
> > > > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> > > > INFO: DerbyUtil.java: shutdown() invoked
> > > > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil loadDriver
> > > > INFO: DerbyUtil.java: loadDriver(): Loaded driver
> > > > (org.apache.derby.jdbc.EmbeddedDriver) successfully
> > > > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> > > > INFO: DerbyUtil.java: shutdown(): Derby shut down normally
> > > > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > > INFO: gCalUtil.shutdown() completed
> > > > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > > INFO: jodConverter.shutdown() completed
> > > > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> > > > INFO: ApplicationMessageBean.shutdown() BEGIN
> > > > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> > > > INFO: ApplicationMessageBean.shutdown() END
> > > > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > > INFO: applicationMessageBean.shutdown() completed
> > > > Nov 03, 2013 10:12:48 AM pf.ThreadLocalImmolater immolate
> > > > INFO: immolated 305 values in ThreadLocals
> > > > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > > INFO: END
> > > > Nov 03, 2013 10:12:48 AM
> org.apache.activemq.ra.ActiveMQEndpointWorker
> > > stop
> > > > INFO: Stopping
> > > > Nov 03, 2013 10:12:48 AM
> org.apache.activemq.ra.ActiveMQEndpointWorker
> > > stop
> > > > INFO: Stopping
> > > > [EL Info]: 2013-11-03
> > > >
> > > >
> > >
> >
> 10:12:48.682--ServerSession(1206174612)--file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/mcmsweb/WEB-INF/classes/_mcmsPU
> > > > logout successful
> > > > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> > > > clearReferencesThreads
> > > > SEVERE: The web application [/mcmsweb] appears to have started a
> thread
> > > > named [PoolIdleReleaseTimer] but has failed to stop it. This is very
> > > likely
> > > > to create a memory leak.
> > > > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> > > > clearReferencesThreads
> > > > SEVERE: The web application [/mcmsweb] appears to have started a
> thread
> > > > named [ActiveMQ VMTransport: vm://localhost#5-5] but has failed to
> stop
> > > it.
> > > > This is very likely to create a memory leak.
> > > > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> > > > clearReferencesThreads
> > > > SEVERE: The web application [/mcmsweb] appears to have started a
> thread
> > > > named [ActiveMQ VMTransport: vm://localhost#5-6] but has failed to
> stop
> > > it.
> > > > This is very likely to create a memory leak.
> > > > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> > > > clearReferencesThreads
> > > > SEVERE: The web application [/mcmsweb] appears to have started a
> thread
> > > > named [ActiveMQ VMTransport: vm://localhost#4-4] but has failed to
> stop
> > > it.
> > > > This is very likely to create a memory leak.
> > > > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> > > > INFO: Stopping ProtocolHandler ["http-nio-8080"]
> > > > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> > > > INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
> > > > Nov 03, 2013 10:12:57 AM
> org.apache.openejb.server.SimpleServiceManager
> > > > stop
> > > > INFO: Stopping server services
> > > > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> > > > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutting
> down.
> > > > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler standby
> > > > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB paused.
> > > > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler
> unregisterJMX
> > > > INFO: Scheduler unregistered from name
> > > >
> > > >
> > >
> >
> 'quartz:type=QuartzScheduler,name=OpenEJB-TimerService-Scheduler,instance=OpenEJB'
> > > > in the local MBeanServer.
> > > > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> > > > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutdown
> > > complete.
> > > > Nov 03, 2013 10:12:57 AM
> org.apache.openejb.assembler.classic.Assembler
> > > > destroyApplication
> > > > INFO: Undeploying app: openejb
> > > > Nov 03, 2013 10:12:57 AM
> org.apache.openejb.assembler.classic.Assembler
> > > > destroyResource
> > > > INFO: Closing DataSource: main
> > > > Nov 03, 2013 10:12:57 AM
> org.apache.openejb.assembler.classic.Assembler
> > > > destroyResource
> > > > INFO: Closing DataSource: fallback
> > > > Nov 03, 2013 10:12:57 AM
> org.apache.openejb.assembler.classic.Assembler
> > > > destroyResource
> > > > INFO: Stopping ResourceAdapter: Default JMS Resource Adapter
> > > > Nov 03, 2013 10:12:57 AM
> > > > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stop
> > > > INFO: Stopping ActiveMQ
> > > > Nov 03, 2013 10:12:58 AM
> > > > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stopImpl
> > > > INFO: Stopped ActiveMQ broker
> > > > Nov 03, 2013 10:12:58 AM
> org.apache.openejb.assembler.classic.Assembler
> > > > destroyResource
> > > > INFO: Closing DataSource: Default Unmanaged JDBC Database
> > > > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> > > > INFO: Destroying ProtocolHandler ["http-nio-8080"]
> > > > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> > > > INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
> > > >
> > > >
> > > >
> > > > On Sun, Nov 3, 2013 at 9:55 AM, Howard W. Smith, Jr. <
> > > > smithh032772@gmail.com
> > > > > wrote:
> > > >
> > > > > okay, i set it up as your post demonstrated, I tested already, and
> I
> > > see
> > > > > no issues. it's time to test this in production. :)
> > > > >
> > > > > thanks romain! like i said in the other thread, I wish I knew about
> > > this
> > > > > earlier.
> > > > >
> > > > >
> > > > >
> > > > > On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
> > > > > smithh032772@gmail.com> wrote:
> > > > >
> > > > >> So, the following replaces service-jar.xml (as per your post)?
> > > > >>
> > > > >> <Resource id="jdbc/ds" type="DataSource"
> > provider="RoutedDataSource">
> > > > >>    router = failover-router
> > > > >> </Resource>
> > > > >>
> > > > >> and if I wanted to use the 'strategy' parameter, I would add to
> > > Resource
> > > > >> as demonstrated below?
> > > > >>
> > > > >> <Resource id="jdbc/ds" type="DataSource"
> > provider="RoutedDataSource">
> > > > >>    router = failover-router
> > > > >>    strategy = random
> > > > >> </Resource>
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > > >> On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <
> > > > rmannibucau@gmail.com
> > > > >> > wrote:
> > > > >>
> > > > >>> Hi
> > > > >>>
> > > > >>> Failover is native but to customiee the algo you can code
> anything
> > > you
> > > > >>> want
> > > > >>>
> > > > >>> Tomee.xml is openejb.xml
> > > > >>>
> > > > >>> Service-jar.xml is today useless (see my post)
> > > > >>> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <
> > smithh032772@gmail.com
> > > >
> > > > a
> > > > >>> écrit :
> > > > >>>
> > > > >>> > First of all, thanks Romain for recommending the following, and
> > for
> > > > >>> that I
> > > > >>> > will gladly start a new thread. :)
> > > > >>> >
> > > > >>> > TomEE/OpenEJB and failover of datasources[1]
> > > > >>> >
> > > > >>> > which references
> > > > >>> >
> > > > >>> > [OpenEJB] Dynamic Datasource[2]
> > > > >>> >
> > > > >>> > but I found the following  TomEE example:
> > > > >>> >
> > > > >>> > [TomEE] Dynamic Datasource Routing[3]
> > > > >>> >
> > > > >>> > So, before I begin, my questions are as follows:
> > > > >>> >
> > > > >>> > 1. I recognized that failover[1] says that the idea is to
> 'reuse'
> > > > >>> dynamic
> > > > >>> > datasource. Does this mean that we should code openejb[2] or
> > > tomee[3]
> > > > >>> > dynamic datasource, first, and then reference accordingly via
> > > > >>> failover[1]?
> > > > >>> >
> > > > >>> > 2. or failover[1] requires no coding on our part? only
> developer
> > > > needs
> > > > >>> to
> > > > >>> > setup the failover 'config'?
> > > > >>> >
> > > > >>> > 3. also, tomee[3] dynamic datasource routing recommends
> > openejb.xml
> > > > >>> > (instead of tomee.xml). can openejb.xml cofiguration be placed
> in
> > > > >>> > tomee.xml, too, or not?
> > > > >>> >
> > > > >>> > 4. okay, never mind, I was abouto ask for some clarification
> > about
> > > > >>> > META-INF/org.router/service-jar.xml, but I 'found'
> > service-jar.xml
> > > on
> > > > >>> > trunk[4]. :)
> > > > >>> >
> > > > >>> >
> > > > >>> >
> > > > >>> > [1]
> > > > >>> >
> > > > >>> >
> > > > >>>
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
> > > > >>> >
> > > > >>> > [2] http://tomee.apache.org/dynamic-datasource.html
> > > > >>> >
> > > > >>> > [3]
> > > > >>> >
> > > > >>> >
> > > > >>>
> > > >
> > >
> >
> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
> > > > >>> >
> > > > >>> > [4]
> > > > >>> >
> > > > >>> >
> > > > >>>
> > > >
> > >
> >
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
> > > > >>> >
> > > > >>>
> > > > >>
> > > > >>
> > > > >
> > > >
> > >
> >
>
>
>
> --
> Jean-Louis
>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by Romain Manni-Bucau <rm...@gmail.com>.
can -> yes (just return a datasource proxy which does the same on all
datasources for each invocation)
should -> no (databases have hard times implementing it so just use
it, it will be better regarding all aspects - excepted $$ maybe)
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2013/11/4 Howard W. Smith, Jr. <sm...@gmail.com>:
> hmmm okay. can/should tomee/openejb 'dynamic datasources' be used to
> replicate data across all databases via some custom JPA persist method that
> I would code in routed datasource?
>
> i'm asking this question after yesterday's review of the (tomee and
> openejb) dynamic datasources documentation and code samples.
>
>
>
> On Mon, Nov 4, 2013 at 10:21 AM, Romain Manni-Bucau
> <rm...@gmail.com>wrote:
>
>> this doesn't replicate by default bu tif your databases are replicated
>> it would work
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>>
>> 2013/11/4 Howard W. Smith, Jr. <sm...@gmail.com>:
>> > response inline below,
>> >
>> > On Sun, Nov 3, 2013 at 10:51 AM, Jean-Louis MONTEIRO <jeanouii@gmail.com
>> >wrote:
>> >
>> >> Well, we pushed that feature some years ago already.
>> >> We mainly used it to implement a failover mechanism, or to implement
>> kinda
>> >> cloud features, I mean having each customer data in different databases.
>> >> Also the read mostly pattern AFAIR.
>> >>
>> >
>> > okay, I can see how tomee failover supports this (customer data in
>> > different databases), ATM, unless I'm missing something.
>> >
>> >
>> >>
>> >> Restrictions are mainly transactions not shared and not wrapping
>> >> connections from more than one datasource.
>> >>
>> >
>> > I think I confirmed this, too.
>> >
>> >
>> >> The cache configuration must be well configured to not cache stale data.
>> >> But it clearly depends on the use case.
>> >>
>> >>
>> > i just did some light testing, created a new row in users table in db1,
>> and
>> > the new row was 'not' added to the same table in db2. I tried both
>> configs
>> > below, and they both had the same test results.
>> >
>> > --- test 1 ---
>> >
>> > <Resource id="jdbc/mcmsJta" type="DataSource"
>> provider="RoutedDataSource">
>> >   router = failover-router
>> > </Resource>
>> >
>> >
>> > --- test 2 ---
>> >
>> > <Resource id="jdbc/mcmsJta" type="DataSource"
>> provider="RoutedDataSource">
>> >   router = failover-router
>> >   strategy = round-robin
>> > </Resource>
>> >
>> > romain, earlier, you mentioned that maybe this tomee/openejb failover via
>> > dynamic datasources may be more/less what i'm looking for. I assumed that
>> > this would be a viable replication solution. did I assume incorrectly?
>>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
hmmm okay. can/should tomee/openejb 'dynamic datasources' be used to
replicate data across all databases via some custom JPA persist method that
I would code in routed datasource?

i'm asking this question after yesterday's review of the (tomee and
openejb) dynamic datasources documentation and code samples.



On Mon, Nov 4, 2013 at 10:21 AM, Romain Manni-Bucau
<rm...@gmail.com>wrote:

> this doesn't replicate by default bu tif your databases are replicated
> it would work
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
>
> 2013/11/4 Howard W. Smith, Jr. <sm...@gmail.com>:
> > response inline below,
> >
> > On Sun, Nov 3, 2013 at 10:51 AM, Jean-Louis MONTEIRO <jeanouii@gmail.com
> >wrote:
> >
> >> Well, we pushed that feature some years ago already.
> >> We mainly used it to implement a failover mechanism, or to implement
> kinda
> >> cloud features, I mean having each customer data in different databases.
> >> Also the read mostly pattern AFAIR.
> >>
> >
> > okay, I can see how tomee failover supports this (customer data in
> > different databases), ATM, unless I'm missing something.
> >
> >
> >>
> >> Restrictions are mainly transactions not shared and not wrapping
> >> connections from more than one datasource.
> >>
> >
> > I think I confirmed this, too.
> >
> >
> >> The cache configuration must be well configured to not cache stale data.
> >> But it clearly depends on the use case.
> >>
> >>
> > i just did some light testing, created a new row in users table in db1,
> and
> > the new row was 'not' added to the same table in db2. I tried both
> configs
> > below, and they both had the same test results.
> >
> > --- test 1 ---
> >
> > <Resource id="jdbc/mcmsJta" type="DataSource"
> provider="RoutedDataSource">
> >   router = failover-router
> > </Resource>
> >
> >
> > --- test 2 ---
> >
> > <Resource id="jdbc/mcmsJta" type="DataSource"
> provider="RoutedDataSource">
> >   router = failover-router
> >   strategy = round-robin
> > </Resource>
> >
> > romain, earlier, you mentioned that maybe this tomee/openejb failover via
> > dynamic datasources may be more/less what i'm looking for. I assumed that
> > this would be a viable replication solution. did I assume incorrectly?
>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by Romain Manni-Bucau <rm...@gmail.com>.
this doesn't replicate by default bu tif your databases are replicated
it would work
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2013/11/4 Howard W. Smith, Jr. <sm...@gmail.com>:
> response inline below,
>
> On Sun, Nov 3, 2013 at 10:51 AM, Jean-Louis MONTEIRO <je...@gmail.com>wrote:
>
>> Well, we pushed that feature some years ago already.
>> We mainly used it to implement a failover mechanism, or to implement kinda
>> cloud features, I mean having each customer data in different databases.
>> Also the read mostly pattern AFAIR.
>>
>
> okay, I can see how tomee failover supports this (customer data in
> different databases), ATM, unless I'm missing something.
>
>
>>
>> Restrictions are mainly transactions not shared and not wrapping
>> connections from more than one datasource.
>>
>
> I think I confirmed this, too.
>
>
>> The cache configuration must be well configured to not cache stale data.
>> But it clearly depends on the use case.
>>
>>
> i just did some light testing, created a new row in users table in db1, and
> the new row was 'not' added to the same table in db2. I tried both configs
> below, and they both had the same test results.
>
> --- test 1 ---
>
> <Resource id="jdbc/mcmsJta" type="DataSource" provider="RoutedDataSource">
>   router = failover-router
> </Resource>
>
>
> --- test 2 ---
>
> <Resource id="jdbc/mcmsJta" type="DataSource" provider="RoutedDataSource">
>   router = failover-router
>   strategy = round-robin
> </Resource>
>
> romain, earlier, you mentioned that maybe this tomee/openejb failover via
> dynamic datasources may be more/less what i'm looking for. I assumed that
> this would be a viable replication solution. did I assume incorrectly?

Re: Using TomEE/OpenEJB and failover of datasources

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
response inline below,

On Sun, Nov 3, 2013 at 10:51 AM, Jean-Louis MONTEIRO <je...@gmail.com>wrote:

> Well, we pushed that feature some years ago already.
> We mainly used it to implement a failover mechanism, or to implement kinda
> cloud features, I mean having each customer data in different databases.
> Also the read mostly pattern AFAIR.
>

okay, I can see how tomee failover supports this (customer data in
different databases), ATM, unless I'm missing something.


>
> Restrictions are mainly transactions not shared and not wrapping
> connections from more than one datasource.
>

I think I confirmed this, too.


> The cache configuration must be well configured to not cache stale data.
> But it clearly depends on the use case.
>
>
i just did some light testing, created a new row in users table in db1, and
the new row was 'not' added to the same table in db2. I tried both configs
below, and they both had the same test results.

--- test 1 ---

<Resource id="jdbc/mcmsJta" type="DataSource" provider="RoutedDataSource">
  router = failover-router
</Resource>


--- test 2 ---

<Resource id="jdbc/mcmsJta" type="DataSource" provider="RoutedDataSource">
  router = failover-router
  strategy = round-robin
</Resource>

romain, earlier, you mentioned that maybe this tomee/openejb failover via
dynamic datasources may be more/less what i'm looking for. I assumed that
this would be a viable replication solution. did I assume incorrectly?

Re: Using TomEE/OpenEJB and failover of datasources

Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
Well, we pushed that feature some years ago already.
We mainly used it to implement a failover mechanism, or to implement kinda
cloud features, I mean having each customer data in different databases.
Also the read mostly pattern AFAIR.

Restrictions are mainly transactions not shared and not wrapping
connections from more than one datasource.
The cache configuration must be well configured to not cache stale data.
But it clearly depends on the use case.

Hope that helps.

JLouis


2013/11/3 Howard W. Smith, Jr. <sm...@gmail.com>

> okay, and one last question, is there a bit more documentation on the
> following, so we can know what to expect, and the implementation is quite
> sound, working as designed and no known issues with the following?
>
> <ul>
> <li>default: the first is used while possible and others datasources are
> just backup, this is typically the failover case</li>
> <li>random: any datasource of the list is used</li>
> <li>reverse: between two call to a method the list is reversed</li>
> <li>round-robin[%N]: round robin between datasources, you can specify how
> many step you browse between two calls using N (default is 1)</li>
> </ul>
>
> i saw the limitations on the referenced pages (dynamic datasources), but I
> didn't see any known issues in your/Romain's post/blog.
>
> please excuse my ignorance, if I have not heard or seen much chatter about
> this on the mail list. I usually try to pay attention to almost all tomee
> emails, especially those that interest me the most. :)
>
>
>
>
> On Sun, Nov 3, 2013 at 10:22 AM, Romain Manni-Bucau
> <rm...@gmail.com>wrote:
>
> > If you dont use it then thats ok. We close the pool then, not connections
> > Le 3 nov. 2013 16:19, "Howard W. Smith, Jr." <sm...@gmail.com> a
> > écrit :
> >
> > > FYI, I just stopped my local tomee, and recognized that my @Application
> > > @PreDestroy has my code that stops Apache Derby prior to main and
> > fallback
> > > datasources are closed.
> > >
> > > is this okay?
> > >
> > > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardServer await
> > > INFO: A valid shutdown command was received via the shutdown port.
> > Stopping
> > > the Server instance.
> > > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> > > INFO: Pausing ProtocolHandler ["http-nio-8080"]
> > > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> > > INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
> > > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardService
> > > stopInternal
> > > INFO: Stopping service Catalina
> > > Nov 03, 2013 10:12:48 AM pf.LoginFilter destroy
> > > INFO: ...
> > > Nov 03, 2013 10:12:48 AM org.apache.openejb.assembler.classic.Assembler
> > > destroyApplication
> > > INFO: Undeploying app:
> > C:\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\mcmsweb
> > > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > INFO: BEGIN
> > > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> > > INFO: DerbyUtil.java: shutdown() invoked
> > > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil loadDriver
> > > INFO: DerbyUtil.java: loadDriver(): Loaded driver
> > > (org.apache.derby.jdbc.EmbeddedDriver) successfully
> > > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> > > INFO: DerbyUtil.java: shutdown(): Derby shut down normally
> > > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > INFO: gCalUtil.shutdown() completed
> > > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > INFO: jodConverter.shutdown() completed
> > > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> > > INFO: ApplicationMessageBean.shutdown() BEGIN
> > > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> > > INFO: ApplicationMessageBean.shutdown() END
> > > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > INFO: applicationMessageBean.shutdown() completed
> > > Nov 03, 2013 10:12:48 AM pf.ThreadLocalImmolater immolate
> > > INFO: immolated 305 values in ThreadLocals
> > > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > > INFO: END
> > > Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker
> > stop
> > > INFO: Stopping
> > > Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker
> > stop
> > > INFO: Stopping
> > > [EL Info]: 2013-11-03
> > >
> > >
> >
> 10:12:48.682--ServerSession(1206174612)--file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/mcmsweb/WEB-INF/classes/_mcmsPU
> > > logout successful
> > > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> > > clearReferencesThreads
> > > SEVERE: The web application [/mcmsweb] appears to have started a thread
> > > named [PoolIdleReleaseTimer] but has failed to stop it. This is very
> > likely
> > > to create a memory leak.
> > > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> > > clearReferencesThreads
> > > SEVERE: The web application [/mcmsweb] appears to have started a thread
> > > named [ActiveMQ VMTransport: vm://localhost#5-5] but has failed to stop
> > it.
> > > This is very likely to create a memory leak.
> > > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> > > clearReferencesThreads
> > > SEVERE: The web application [/mcmsweb] appears to have started a thread
> > > named [ActiveMQ VMTransport: vm://localhost#5-6] but has failed to stop
> > it.
> > > This is very likely to create a memory leak.
> > > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> > > clearReferencesThreads
> > > SEVERE: The web application [/mcmsweb] appears to have started a thread
> > > named [ActiveMQ VMTransport: vm://localhost#4-4] but has failed to stop
> > it.
> > > This is very likely to create a memory leak.
> > > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> > > INFO: Stopping ProtocolHandler ["http-nio-8080"]
> > > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> > > INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
> > > Nov 03, 2013 10:12:57 AM org.apache.openejb.server.SimpleServiceManager
> > > stop
> > > INFO: Stopping server services
> > > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> > > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutting down.
> > > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler standby
> > > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB paused.
> > > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler unregisterJMX
> > > INFO: Scheduler unregistered from name
> > >
> > >
> >
> 'quartz:type=QuartzScheduler,name=OpenEJB-TimerService-Scheduler,instance=OpenEJB'
> > > in the local MBeanServer.
> > > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> > > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutdown
> > complete.
> > > Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> > > destroyApplication
> > > INFO: Undeploying app: openejb
> > > Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> > > destroyResource
> > > INFO: Closing DataSource: main
> > > Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> > > destroyResource
> > > INFO: Closing DataSource: fallback
> > > Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> > > destroyResource
> > > INFO: Stopping ResourceAdapter: Default JMS Resource Adapter
> > > Nov 03, 2013 10:12:57 AM
> > > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stop
> > > INFO: Stopping ActiveMQ
> > > Nov 03, 2013 10:12:58 AM
> > > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stopImpl
> > > INFO: Stopped ActiveMQ broker
> > > Nov 03, 2013 10:12:58 AM org.apache.openejb.assembler.classic.Assembler
> > > destroyResource
> > > INFO: Closing DataSource: Default Unmanaged JDBC Database
> > > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> > > INFO: Destroying ProtocolHandler ["http-nio-8080"]
> > > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> > > INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
> > >
> > >
> > >
> > > On Sun, Nov 3, 2013 at 9:55 AM, Howard W. Smith, Jr. <
> > > smithh032772@gmail.com
> > > > wrote:
> > >
> > > > okay, i set it up as your post demonstrated, I tested already, and I
> > see
> > > > no issues. it's time to test this in production. :)
> > > >
> > > > thanks romain! like i said in the other thread, I wish I knew about
> > this
> > > > earlier.
> > > >
> > > >
> > > >
> > > > On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
> > > > smithh032772@gmail.com> wrote:
> > > >
> > > >> So, the following replaces service-jar.xml (as per your post)?
> > > >>
> > > >> <Resource id="jdbc/ds" type="DataSource"
> provider="RoutedDataSource">
> > > >>    router = failover-router
> > > >> </Resource>
> > > >>
> > > >> and if I wanted to use the 'strategy' parameter, I would add to
> > Resource
> > > >> as demonstrated below?
> > > >>
> > > >> <Resource id="jdbc/ds" type="DataSource"
> provider="RoutedDataSource">
> > > >>    router = failover-router
> > > >>    strategy = random
> > > >> </Resource>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >> On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > >> > wrote:
> > > >>
> > > >>> Hi
> > > >>>
> > > >>> Failover is native but to customiee the algo you can code anything
> > you
> > > >>> want
> > > >>>
> > > >>> Tomee.xml is openejb.xml
> > > >>>
> > > >>> Service-jar.xml is today useless (see my post)
> > > >>> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <
> smithh032772@gmail.com
> > >
> > > a
> > > >>> écrit :
> > > >>>
> > > >>> > First of all, thanks Romain for recommending the following, and
> for
> > > >>> that I
> > > >>> > will gladly start a new thread. :)
> > > >>> >
> > > >>> > TomEE/OpenEJB and failover of datasources[1]
> > > >>> >
> > > >>> > which references
> > > >>> >
> > > >>> > [OpenEJB] Dynamic Datasource[2]
> > > >>> >
> > > >>> > but I found the following  TomEE example:
> > > >>> >
> > > >>> > [TomEE] Dynamic Datasource Routing[3]
> > > >>> >
> > > >>> > So, before I begin, my questions are as follows:
> > > >>> >
> > > >>> > 1. I recognized that failover[1] says that the idea is to 'reuse'
> > > >>> dynamic
> > > >>> > datasource. Does this mean that we should code openejb[2] or
> > tomee[3]
> > > >>> > dynamic datasource, first, and then reference accordingly via
> > > >>> failover[1]?
> > > >>> >
> > > >>> > 2. or failover[1] requires no coding on our part? only developer
> > > needs
> > > >>> to
> > > >>> > setup the failover 'config'?
> > > >>> >
> > > >>> > 3. also, tomee[3] dynamic datasource routing recommends
> openejb.xml
> > > >>> > (instead of tomee.xml). can openejb.xml cofiguration be placed in
> > > >>> > tomee.xml, too, or not?
> > > >>> >
> > > >>> > 4. okay, never mind, I was abouto ask for some clarification
> about
> > > >>> > META-INF/org.router/service-jar.xml, but I 'found'
> service-jar.xml
> > on
> > > >>> > trunk[4]. :)
> > > >>> >
> > > >>> >
> > > >>> >
> > > >>> > [1]
> > > >>> >
> > > >>> >
> > > >>>
> > >
> >
> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
> > > >>> >
> > > >>> > [2] http://tomee.apache.org/dynamic-datasource.html
> > > >>> >
> > > >>> > [3]
> > > >>> >
> > > >>> >
> > > >>>
> > >
> >
> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
> > > >>> >
> > > >>> > [4]
> > > >>> >
> > > >>> >
> > > >>>
> > >
> >
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
> > > >>> >
> > > >>>
> > > >>
> > > >>
> > > >
> > >
> >
>



-- 
Jean-Louis

Re: Using TomEE/OpenEJB and failover of datasources

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
okay, and one last question, is there a bit more documentation on the
following, so we can know what to expect, and the implementation is quite
sound, working as designed and no known issues with the following?

<ul>
<li>default: the first is used while possible and others datasources are
just backup, this is typically the failover case</li>
<li>random: any datasource of the list is used</li>
<li>reverse: between two call to a method the list is reversed</li>
<li>round-robin[%N]: round robin between datasources, you can specify how
many step you browse between two calls using N (default is 1)</li>
</ul>

i saw the limitations on the referenced pages (dynamic datasources), but I
didn't see any known issues in your/Romain's post/blog.

please excuse my ignorance, if I have not heard or seen much chatter about
this on the mail list. I usually try to pay attention to almost all tomee
emails, especially those that interest me the most. :)




On Sun, Nov 3, 2013 at 10:22 AM, Romain Manni-Bucau
<rm...@gmail.com>wrote:

> If you dont use it then thats ok. We close the pool then, not connections
> Le 3 nov. 2013 16:19, "Howard W. Smith, Jr." <sm...@gmail.com> a
> écrit :
>
> > FYI, I just stopped my local tomee, and recognized that my @Application
> > @PreDestroy has my code that stops Apache Derby prior to main and
> fallback
> > datasources are closed.
> >
> > is this okay?
> >
> > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardServer await
> > INFO: A valid shutdown command was received via the shutdown port.
> Stopping
> > the Server instance.
> > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> > INFO: Pausing ProtocolHandler ["http-nio-8080"]
> > Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> > INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
> > Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardService
> > stopInternal
> > INFO: Stopping service Catalina
> > Nov 03, 2013 10:12:48 AM pf.LoginFilter destroy
> > INFO: ...
> > Nov 03, 2013 10:12:48 AM org.apache.openejb.assembler.classic.Assembler
> > destroyApplication
> > INFO: Undeploying app:
> C:\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\mcmsweb
> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > INFO: BEGIN
> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> > INFO: DerbyUtil.java: shutdown() invoked
> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil loadDriver
> > INFO: DerbyUtil.java: loadDriver(): Loaded driver
> > (org.apache.derby.jdbc.EmbeddedDriver) successfully
> > Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> > INFO: DerbyUtil.java: shutdown(): Derby shut down normally
> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > INFO: gCalUtil.shutdown() completed
> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > INFO: jodConverter.shutdown() completed
> > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> > INFO: ApplicationMessageBean.shutdown() BEGIN
> > Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> > INFO: ApplicationMessageBean.shutdown() END
> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > INFO: applicationMessageBean.shutdown() completed
> > Nov 03, 2013 10:12:48 AM pf.ThreadLocalImmolater immolate
> > INFO: immolated 305 values in ThreadLocals
> > Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> > INFO: END
> > Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker
> stop
> > INFO: Stopping
> > Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker
> stop
> > INFO: Stopping
> > [EL Info]: 2013-11-03
> >
> >
> 10:12:48.682--ServerSession(1206174612)--file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/mcmsweb/WEB-INF/classes/_mcmsPU
> > logout successful
> > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> > clearReferencesThreads
> > SEVERE: The web application [/mcmsweb] appears to have started a thread
> > named [PoolIdleReleaseTimer] but has failed to stop it. This is very
> likely
> > to create a memory leak.
> > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> > clearReferencesThreads
> > SEVERE: The web application [/mcmsweb] appears to have started a thread
> > named [ActiveMQ VMTransport: vm://localhost#5-5] but has failed to stop
> it.
> > This is very likely to create a memory leak.
> > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> > clearReferencesThreads
> > SEVERE: The web application [/mcmsweb] appears to have started a thread
> > named [ActiveMQ VMTransport: vm://localhost#5-6] but has failed to stop
> it.
> > This is very likely to create a memory leak.
> > Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> > clearReferencesThreads
> > SEVERE: The web application [/mcmsweb] appears to have started a thread
> > named [ActiveMQ VMTransport: vm://localhost#4-4] but has failed to stop
> it.
> > This is very likely to create a memory leak.
> > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> > INFO: Stopping ProtocolHandler ["http-nio-8080"]
> > Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> > INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
> > Nov 03, 2013 10:12:57 AM org.apache.openejb.server.SimpleServiceManager
> > stop
> > INFO: Stopping server services
> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutting down.
> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler standby
> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB paused.
> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler unregisterJMX
> > INFO: Scheduler unregistered from name
> >
> >
> 'quartz:type=QuartzScheduler,name=OpenEJB-TimerService-Scheduler,instance=OpenEJB'
> > in the local MBeanServer.
> > Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> > INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutdown
> complete.
> > Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> > destroyApplication
> > INFO: Undeploying app: openejb
> > Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> > destroyResource
> > INFO: Closing DataSource: main
> > Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> > destroyResource
> > INFO: Closing DataSource: fallback
> > Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> > destroyResource
> > INFO: Stopping ResourceAdapter: Default JMS Resource Adapter
> > Nov 03, 2013 10:12:57 AM
> > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stop
> > INFO: Stopping ActiveMQ
> > Nov 03, 2013 10:12:58 AM
> > org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stopImpl
> > INFO: Stopped ActiveMQ broker
> > Nov 03, 2013 10:12:58 AM org.apache.openejb.assembler.classic.Assembler
> > destroyResource
> > INFO: Closing DataSource: Default Unmanaged JDBC Database
> > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> > INFO: Destroying ProtocolHandler ["http-nio-8080"]
> > Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> > INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
> >
> >
> >
> > On Sun, Nov 3, 2013 at 9:55 AM, Howard W. Smith, Jr. <
> > smithh032772@gmail.com
> > > wrote:
> >
> > > okay, i set it up as your post demonstrated, I tested already, and I
> see
> > > no issues. it's time to test this in production. :)
> > >
> > > thanks romain! like i said in the other thread, I wish I knew about
> this
> > > earlier.
> > >
> > >
> > >
> > > On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
> > > smithh032772@gmail.com> wrote:
> > >
> > >> So, the following replaces service-jar.xml (as per your post)?
> > >>
> > >> <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
> > >>    router = failover-router
> > >> </Resource>
> > >>
> > >> and if I wanted to use the 'strategy' parameter, I would add to
> Resource
> > >> as demonstrated below?
> > >>
> > >> <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
> > >>    router = failover-router
> > >>    strategy = random
> > >> </Resource>
> > >>
> > >>
> > >>
> > >>
> > >> On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > >> > wrote:
> > >>
> > >>> Hi
> > >>>
> > >>> Failover is native but to customiee the algo you can code anything
> you
> > >>> want
> > >>>
> > >>> Tomee.xml is openejb.xml
> > >>>
> > >>> Service-jar.xml is today useless (see my post)
> > >>> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <smithh032772@gmail.com
> >
> > a
> > >>> écrit :
> > >>>
> > >>> > First of all, thanks Romain for recommending the following, and for
> > >>> that I
> > >>> > will gladly start a new thread. :)
> > >>> >
> > >>> > TomEE/OpenEJB and failover of datasources[1]
> > >>> >
> > >>> > which references
> > >>> >
> > >>> > [OpenEJB] Dynamic Datasource[2]
> > >>> >
> > >>> > but I found the following  TomEE example:
> > >>> >
> > >>> > [TomEE] Dynamic Datasource Routing[3]
> > >>> >
> > >>> > So, before I begin, my questions are as follows:
> > >>> >
> > >>> > 1. I recognized that failover[1] says that the idea is to 'reuse'
> > >>> dynamic
> > >>> > datasource. Does this mean that we should code openejb[2] or
> tomee[3]
> > >>> > dynamic datasource, first, and then reference accordingly via
> > >>> failover[1]?
> > >>> >
> > >>> > 2. or failover[1] requires no coding on our part? only developer
> > needs
> > >>> to
> > >>> > setup the failover 'config'?
> > >>> >
> > >>> > 3. also, tomee[3] dynamic datasource routing recommends openejb.xml
> > >>> > (instead of tomee.xml). can openejb.xml cofiguration be placed in
> > >>> > tomee.xml, too, or not?
> > >>> >
> > >>> > 4. okay, never mind, I was abouto ask for some clarification about
> > >>> > META-INF/org.router/service-jar.xml, but I 'found' service-jar.xml
> on
> > >>> > trunk[4]. :)
> > >>> >
> > >>> >
> > >>> >
> > >>> > [1]
> > >>> >
> > >>> >
> > >>>
> >
> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
> > >>> >
> > >>> > [2] http://tomee.apache.org/dynamic-datasource.html
> > >>> >
> > >>> > [3]
> > >>> >
> > >>> >
> > >>>
> >
> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
> > >>> >
> > >>> > [4]
> > >>> >
> > >>> >
> > >>>
> >
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
> > >>> >
> > >>>
> > >>
> > >>
> > >
> >
>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by Romain Manni-Bucau <rm...@gmail.com>.
If you dont use it then thats ok. We close the pool then, not connections
Le 3 nov. 2013 16:19, "Howard W. Smith, Jr." <sm...@gmail.com> a
écrit :

> FYI, I just stopped my local tomee, and recognized that my @Application
> @PreDestroy has my code that stops Apache Derby prior to main and fallback
> datasources are closed.
>
> is this okay?
>
> Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardServer await
> INFO: A valid shutdown command was received via the shutdown port. Stopping
> the Server instance.
> Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> INFO: Pausing ProtocolHandler ["http-nio-8080"]
> Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
> INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
> Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardService
> stopInternal
> INFO: Stopping service Catalina
> Nov 03, 2013 10:12:48 AM pf.LoginFilter destroy
> INFO: ...
> Nov 03, 2013 10:12:48 AM org.apache.openejb.assembler.classic.Assembler
> destroyApplication
> INFO: Undeploying app: C:\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\mcmsweb
> Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> INFO: BEGIN
> Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> INFO: DerbyUtil.java: shutdown() invoked
> Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil loadDriver
> INFO: DerbyUtil.java: loadDriver(): Loaded driver
> (org.apache.derby.jdbc.EmbeddedDriver) successfully
> Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
> INFO: DerbyUtil.java: shutdown(): Derby shut down normally
> Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> INFO: gCalUtil.shutdown() completed
> Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> INFO: jodConverter.shutdown() completed
> Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> INFO: ApplicationMessageBean.shutdown() BEGIN
> Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
> INFO: ApplicationMessageBean.shutdown() END
> Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> INFO: applicationMessageBean.shutdown() completed
> Nov 03, 2013 10:12:48 AM pf.ThreadLocalImmolater immolate
> INFO: immolated 305 values in ThreadLocals
> Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
> INFO: END
> Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker stop
> INFO: Stopping
> Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker stop
> INFO: Stopping
> [EL Info]: 2013-11-03
>
> 10:12:48.682--ServerSession(1206174612)--file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/mcmsweb/WEB-INF/classes/_mcmsPU
> logout successful
> Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreads
> SEVERE: The web application [/mcmsweb] appears to have started a thread
> named [PoolIdleReleaseTimer] but has failed to stop it. This is very likely
> to create a memory leak.
> Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreads
> SEVERE: The web application [/mcmsweb] appears to have started a thread
> named [ActiveMQ VMTransport: vm://localhost#5-5] but has failed to stop it.
> This is very likely to create a memory leak.
> Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreads
> SEVERE: The web application [/mcmsweb] appears to have started a thread
> named [ActiveMQ VMTransport: vm://localhost#5-6] but has failed to stop it.
> This is very likely to create a memory leak.
> Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreads
> SEVERE: The web application [/mcmsweb] appears to have started a thread
> named [ActiveMQ VMTransport: vm://localhost#4-4] but has failed to stop it.
> This is very likely to create a memory leak.
> Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> INFO: Stopping ProtocolHandler ["http-nio-8080"]
> Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
> INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
> Nov 03, 2013 10:12:57 AM org.apache.openejb.server.SimpleServiceManager
> stop
> INFO: Stopping server services
> Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutting down.
> Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler standby
> INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB paused.
> Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler unregisterJMX
> INFO: Scheduler unregistered from name
>
> 'quartz:type=QuartzScheduler,name=OpenEJB-TimerService-Scheduler,instance=OpenEJB'
> in the local MBeanServer.
> Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
> INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutdown complete.
> Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> destroyApplication
> INFO: Undeploying app: openejb
> Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> destroyResource
> INFO: Closing DataSource: main
> Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> destroyResource
> INFO: Closing DataSource: fallback
> Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
> destroyResource
> INFO: Stopping ResourceAdapter: Default JMS Resource Adapter
> Nov 03, 2013 10:12:57 AM
> org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stop
> INFO: Stopping ActiveMQ
> Nov 03, 2013 10:12:58 AM
> org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stopImpl
> INFO: Stopped ActiveMQ broker
> Nov 03, 2013 10:12:58 AM org.apache.openejb.assembler.classic.Assembler
> destroyResource
> INFO: Closing DataSource: Default Unmanaged JDBC Database
> Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> INFO: Destroying ProtocolHandler ["http-nio-8080"]
> Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
> INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
>
>
>
> On Sun, Nov 3, 2013 at 9:55 AM, Howard W. Smith, Jr. <
> smithh032772@gmail.com
> > wrote:
>
> > okay, i set it up as your post demonstrated, I tested already, and I see
> > no issues. it's time to test this in production. :)
> >
> > thanks romain! like i said in the other thread, I wish I knew about this
> > earlier.
> >
> >
> >
> > On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
> > smithh032772@gmail.com> wrote:
> >
> >> So, the following replaces service-jar.xml (as per your post)?
> >>
> >> <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
> >>    router = failover-router
> >> </Resource>
> >>
> >> and if I wanted to use the 'strategy' parameter, I would add to Resource
> >> as demonstrated below?
> >>
> >> <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
> >>    router = failover-router
> >>    strategy = random
> >> </Resource>
> >>
> >>
> >>
> >>
> >> On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> >> > wrote:
> >>
> >>> Hi
> >>>
> >>> Failover is native but to customiee the algo you can code anything you
> >>> want
> >>>
> >>> Tomee.xml is openejb.xml
> >>>
> >>> Service-jar.xml is today useless (see my post)
> >>> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <sm...@gmail.com>
> a
> >>> écrit :
> >>>
> >>> > First of all, thanks Romain for recommending the following, and for
> >>> that I
> >>> > will gladly start a new thread. :)
> >>> >
> >>> > TomEE/OpenEJB and failover of datasources[1]
> >>> >
> >>> > which references
> >>> >
> >>> > [OpenEJB] Dynamic Datasource[2]
> >>> >
> >>> > but I found the following  TomEE example:
> >>> >
> >>> > [TomEE] Dynamic Datasource Routing[3]
> >>> >
> >>> > So, before I begin, my questions are as follows:
> >>> >
> >>> > 1. I recognized that failover[1] says that the idea is to 'reuse'
> >>> dynamic
> >>> > datasource. Does this mean that we should code openejb[2] or tomee[3]
> >>> > dynamic datasource, first, and then reference accordingly via
> >>> failover[1]?
> >>> >
> >>> > 2. or failover[1] requires no coding on our part? only developer
> needs
> >>> to
> >>> > setup the failover 'config'?
> >>> >
> >>> > 3. also, tomee[3] dynamic datasource routing recommends openejb.xml
> >>> > (instead of tomee.xml). can openejb.xml cofiguration be placed in
> >>> > tomee.xml, too, or not?
> >>> >
> >>> > 4. okay, never mind, I was abouto ask for some clarification about
> >>> > META-INF/org.router/service-jar.xml, but I 'found' service-jar.xml on
> >>> > trunk[4]. :)
> >>> >
> >>> >
> >>> >
> >>> > [1]
> >>> >
> >>> >
> >>>
> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
> >>> >
> >>> > [2] http://tomee.apache.org/dynamic-datasource.html
> >>> >
> >>> > [3]
> >>> >
> >>> >
> >>>
> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
> >>> >
> >>> > [4]
> >>> >
> >>> >
> >>>
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
> >>> >
> >>>
> >>
> >>
> >
>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
FYI, I just stopped my local tomee, and recognized that my @Application
@PreDestroy has my code that stops Apache Derby prior to main and fallback
datasources are closed.

is this okay?

Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardServer await
INFO: A valid shutdown command was received via the shutdown port. Stopping
the Server instance.
Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-nio-8080"]
Nov 03, 2013 10:12:48 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Nov 03, 2013 10:12:48 AM org.apache.catalina.core.StandardService
stopInternal
INFO: Stopping service Catalina
Nov 03, 2013 10:12:48 AM pf.LoginFilter destroy
INFO: ...
Nov 03, 2013 10:12:48 AM org.apache.openejb.assembler.classic.Assembler
destroyApplication
INFO: Undeploying app: C:\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\mcmsweb
Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
INFO: BEGIN
Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
INFO: DerbyUtil.java: shutdown() invoked
Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil loadDriver
INFO: DerbyUtil.java: loadDriver(): Loaded driver
(org.apache.derby.jdbc.EmbeddedDriver) successfully
Nov 03, 2013 10:12:48 AM utils.database.DerbyUtil shutdown
INFO: DerbyUtil.java: shutdown(): Derby shut down normally
Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
INFO: gCalUtil.shutdown() completed
Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
INFO: jodConverter.shutdown() completed
Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
INFO: ApplicationMessageBean.shutdown() BEGIN
Nov 03, 2013 10:12:48 AM mdb.ApplicationMessageBean shutdown
INFO: ApplicationMessageBean.shutdown() END
Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
INFO: applicationMessageBean.shutdown() completed
Nov 03, 2013 10:12:48 AM pf.ThreadLocalImmolater immolate
INFO: immolated 305 values in ThreadLocals
Nov 03, 2013 10:12:48 AM pf.ApplicationScopeBean destroy
INFO: END
Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker stop
INFO: Stopping
Nov 03, 2013 10:12:48 AM org.apache.activemq.ra.ActiveMQEndpointWorker stop
INFO: Stopping
[EL Info]: 2013-11-03
10:12:48.682--ServerSession(1206174612)--file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/mcmsweb/WEB-INF/classes/_mcmsPU
logout successful
Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [/mcmsweb] appears to have started a thread
named [PoolIdleReleaseTimer] but has failed to stop it. This is very likely
to create a memory leak.
Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [/mcmsweb] appears to have started a thread
named [ActiveMQ VMTransport: vm://localhost#5-5] but has failed to stop it.
This is very likely to create a memory leak.
Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [/mcmsweb] appears to have started a thread
named [ActiveMQ VMTransport: vm://localhost#5-6] but has failed to stop it.
This is very likely to create a memory leak.
Nov 03, 2013 10:12:49 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [/mcmsweb] appears to have started a thread
named [ActiveMQ VMTransport: vm://localhost#4-4] but has failed to stop it.
This is very likely to create a memory leak.
Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-nio-8080"]
Nov 03, 2013 10:12:57 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Nov 03, 2013 10:12:57 AM org.apache.openejb.server.SimpleServiceManager stop
INFO: Stopping server services
Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutting down.
Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler standby
INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB paused.
Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler unregisterJMX
INFO: Scheduler unregistered from name
'quartz:type=QuartzScheduler,name=OpenEJB-TimerService-Scheduler,instance=OpenEJB'
in the local MBeanServer.
Nov 03, 2013 10:12:57 AM org.quartz.core.QuartzScheduler shutdown
INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB shutdown complete.
Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
destroyApplication
INFO: Undeploying app: openejb
Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
destroyResource
INFO: Closing DataSource: main
Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
destroyResource
INFO: Closing DataSource: fallback
Nov 03, 2013 10:12:57 AM org.apache.openejb.assembler.classic.Assembler
destroyResource
INFO: Stopping ResourceAdapter: Default JMS Resource Adapter
Nov 03, 2013 10:12:57 AM
org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stop
INFO: Stopping ActiveMQ
Nov 03, 2013 10:12:58 AM
org.apache.openejb.resource.activemq.ActiveMQResourceAdapter stopImpl
INFO: Stopped ActiveMQ broker
Nov 03, 2013 10:12:58 AM org.apache.openejb.assembler.classic.Assembler
destroyResource
INFO: Closing DataSource: Default Unmanaged JDBC Database
Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-nio-8080"]
Nov 03, 2013 10:12:58 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]



On Sun, Nov 3, 2013 at 9:55 AM, Howard W. Smith, Jr. <smithh032772@gmail.com
> wrote:

> okay, i set it up as your post demonstrated, I tested already, and I see
> no issues. it's time to test this in production. :)
>
> thanks romain! like i said in the other thread, I wish I knew about this
> earlier.
>
>
>
> On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
> smithh032772@gmail.com> wrote:
>
>> So, the following replaces service-jar.xml (as per your post)?
>>
>> <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
>>    router = failover-router
>> </Resource>
>>
>> and if I wanted to use the 'strategy' parameter, I would add to Resource
>> as demonstrated below?
>>
>> <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
>>    router = failover-router
>>    strategy = random
>> </Resource>
>>
>>
>>
>>
>> On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <rmannibucau@gmail.com
>> > wrote:
>>
>>> Hi
>>>
>>> Failover is native but to customiee the algo you can code anything you
>>> want
>>>
>>> Tomee.xml is openejb.xml
>>>
>>> Service-jar.xml is today useless (see my post)
>>> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <sm...@gmail.com> a
>>> écrit :
>>>
>>> > First of all, thanks Romain for recommending the following, and for
>>> that I
>>> > will gladly start a new thread. :)
>>> >
>>> > TomEE/OpenEJB and failover of datasources[1]
>>> >
>>> > which references
>>> >
>>> > [OpenEJB] Dynamic Datasource[2]
>>> >
>>> > but I found the following  TomEE example:
>>> >
>>> > [TomEE] Dynamic Datasource Routing[3]
>>> >
>>> > So, before I begin, my questions are as follows:
>>> >
>>> > 1. I recognized that failover[1] says that the idea is to 'reuse'
>>> dynamic
>>> > datasource. Does this mean that we should code openejb[2] or tomee[3]
>>> > dynamic datasource, first, and then reference accordingly via
>>> failover[1]?
>>> >
>>> > 2. or failover[1] requires no coding on our part? only developer needs
>>> to
>>> > setup the failover 'config'?
>>> >
>>> > 3. also, tomee[3] dynamic datasource routing recommends openejb.xml
>>> > (instead of tomee.xml). can openejb.xml cofiguration be placed in
>>> > tomee.xml, too, or not?
>>> >
>>> > 4. okay, never mind, I was abouto ask for some clarification about
>>> > META-INF/org.router/service-jar.xml, but I 'found' service-jar.xml on
>>> > trunk[4]. :)
>>> >
>>> >
>>> >
>>> > [1]
>>> >
>>> >
>>> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
>>> >
>>> > [2] http://tomee.apache.org/dynamic-datasource.html
>>> >
>>> > [3]
>>> >
>>> >
>>> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
>>> >
>>> > [4]
>>> >
>>> >
>>> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
>>> >
>>>
>>
>>
>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
thanks Jean-Louis... it remains to be seen. :)




On Sun, Nov 3, 2013 at 10:14 AM, Jean-Louis MONTEIRO <je...@gmail.com>wrote:

> That's great but I'm pretty sure, you know much more than a lot of people.
>
>
> 2013/11/3 Howard W. Smith, Jr. <sm...@gmail.com>
>
> > thanks Jean-Louis... i'm still learning via tomee (committers). :)
> >
> >
> > On Sun, Nov 3, 2013 at 10:00 AM, Jean-Louis MONTEIRO <jeanouii@gmail.com
> > >wrote:
> >
> > > just as next time. If not already there, no issue to add a feature or
> to
> > > propose it by yourself ;-)
> > > New committers always welcome.
> > >
> > >
> > > 2013/11/3 Howard W. Smith, Jr. <sm...@gmail.com>
> > >
> > > > okay, i set it up as your post demonstrated, I tested already, and I
> > see
> > > no
> > > > issues. it's time to test this in production. :)
> > > >
> > > > thanks romain! like i said in the other thread, I wish I knew about
> > this
> > > > earlier.
> > > >
> > > >
> > > >
> > > > On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
> > > > smithh032772@gmail.com
> > > > > wrote:
> > > >
> > > > > So, the following replaces service-jar.xml (as per your post)?
> > > > >
> > > > > <Resource id="jdbc/ds" type="DataSource"
> provider="RoutedDataSource">
> > > > >    router = failover-router
> > > > > </Resource>
> > > > >
> > > > > and if I wanted to use the 'strategy' parameter, I would add to
> > > Resource
> > > > > as demonstrated below?
> > > > >
> > > > > <Resource id="jdbc/ds" type="DataSource"
> provider="RoutedDataSource">
> > > > >    router = failover-router
> > > > >    strategy = random
> > > > > </Resource>
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <
> > > > rmannibucau@gmail.com>wrote:
> > > > >
> > > > >> Hi
> > > > >>
> > > > >> Failover is native but to customiee the algo you can code anything
> > you
> > > > >> want
> > > > >>
> > > > >> Tomee.xml is openejb.xml
> > > > >>
> > > > >> Service-jar.xml is today useless (see my post)
> > > > >> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <
> > smithh032772@gmail.com>
> > > a
> > > > >> écrit :
> > > > >>
> > > > >> > First of all, thanks Romain for recommending the following, and
> > for
> > > > >> that I
> > > > >> > will gladly start a new thread. :)
> > > > >> >
> > > > >> > TomEE/OpenEJB and failover of datasources[1]
> > > > >> >
> > > > >> > which references
> > > > >> >
> > > > >> > [OpenEJB] Dynamic Datasource[2]
> > > > >> >
> > > > >> > but I found the following  TomEE example:
> > > > >> >
> > > > >> > [TomEE] Dynamic Datasource Routing[3]
> > > > >> >
> > > > >> > So, before I begin, my questions are as follows:
> > > > >> >
> > > > >> > 1. I recognized that failover[1] says that the idea is to
> 'reuse'
> > > > >> dynamic
> > > > >> > datasource. Does this mean that we should code openejb[2] or
> > > tomee[3]
> > > > >> > dynamic datasource, first, and then reference accordingly via
> > > > >> failover[1]?
> > > > >> >
> > > > >> > 2. or failover[1] requires no coding on our part? only developer
> > > needs
> > > > >> to
> > > > >> > setup the failover 'config'?
> > > > >> >
> > > > >> > 3. also, tomee[3] dynamic datasource routing recommends
> > openejb.xml
> > > > >> > (instead of tomee.xml). can openejb.xml cofiguration be placed
> in
> > > > >> > tomee.xml, too, or not?
> > > > >> >
> > > > >> > 4. okay, never mind, I was abouto ask for some clarification
> about
> > > > >> > META-INF/org.router/service-jar.xml, but I 'found'
> service-jar.xml
> > > on
> > > > >> > trunk[4]. :)
> > > > >> >
> > > > >> >
> > > > >> >
> > > > >> > [1]
> > > > >> >
> > > > >> >
> > > > >>
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
> > > > >> >
> > > > >> > [2] http://tomee.apache.org/dynamic-datasource.html
> > > > >> >
> > > > >> > [3]
> > > > >> >
> > > > >> >
> > > > >>
> > > >
> > >
> >
> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
> > > > >> >
> > > > >> > [4]
> > > > >> >
> > > > >> >
> > > > >>
> > > >
> > >
> >
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
> > > > >> >
> > > > >>
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Jean-Louis
> > >
> >
>
>
>
> --
> Jean-Louis
>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
That's great but I'm pretty sure, you know much more than a lot of people.


2013/11/3 Howard W. Smith, Jr. <sm...@gmail.com>

> thanks Jean-Louis... i'm still learning via tomee (committers). :)
>
>
> On Sun, Nov 3, 2013 at 10:00 AM, Jean-Louis MONTEIRO <jeanouii@gmail.com
> >wrote:
>
> > just as next time. If not already there, no issue to add a feature or to
> > propose it by yourself ;-)
> > New committers always welcome.
> >
> >
> > 2013/11/3 Howard W. Smith, Jr. <sm...@gmail.com>
> >
> > > okay, i set it up as your post demonstrated, I tested already, and I
> see
> > no
> > > issues. it's time to test this in production. :)
> > >
> > > thanks romain! like i said in the other thread, I wish I knew about
> this
> > > earlier.
> > >
> > >
> > >
> > > On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
> > > smithh032772@gmail.com
> > > > wrote:
> > >
> > > > So, the following replaces service-jar.xml (as per your post)?
> > > >
> > > > <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
> > > >    router = failover-router
> > > > </Resource>
> > > >
> > > > and if I wanted to use the 'strategy' parameter, I would add to
> > Resource
> > > > as demonstrated below?
> > > >
> > > > <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
> > > >    router = failover-router
> > > >    strategy = random
> > > > </Resource>
> > > >
> > > >
> > > >
> > > >
> > > > On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <
> > > rmannibucau@gmail.com>wrote:
> > > >
> > > >> Hi
> > > >>
> > > >> Failover is native but to customiee the algo you can code anything
> you
> > > >> want
> > > >>
> > > >> Tomee.xml is openejb.xml
> > > >>
> > > >> Service-jar.xml is today useless (see my post)
> > > >> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <
> smithh032772@gmail.com>
> > a
> > > >> écrit :
> > > >>
> > > >> > First of all, thanks Romain for recommending the following, and
> for
> > > >> that I
> > > >> > will gladly start a new thread. :)
> > > >> >
> > > >> > TomEE/OpenEJB and failover of datasources[1]
> > > >> >
> > > >> > which references
> > > >> >
> > > >> > [OpenEJB] Dynamic Datasource[2]
> > > >> >
> > > >> > but I found the following  TomEE example:
> > > >> >
> > > >> > [TomEE] Dynamic Datasource Routing[3]
> > > >> >
> > > >> > So, before I begin, my questions are as follows:
> > > >> >
> > > >> > 1. I recognized that failover[1] says that the idea is to 'reuse'
> > > >> dynamic
> > > >> > datasource. Does this mean that we should code openejb[2] or
> > tomee[3]
> > > >> > dynamic datasource, first, and then reference accordingly via
> > > >> failover[1]?
> > > >> >
> > > >> > 2. or failover[1] requires no coding on our part? only developer
> > needs
> > > >> to
> > > >> > setup the failover 'config'?
> > > >> >
> > > >> > 3. also, tomee[3] dynamic datasource routing recommends
> openejb.xml
> > > >> > (instead of tomee.xml). can openejb.xml cofiguration be placed in
> > > >> > tomee.xml, too, or not?
> > > >> >
> > > >> > 4. okay, never mind, I was abouto ask for some clarification about
> > > >> > META-INF/org.router/service-jar.xml, but I 'found' service-jar.xml
> > on
> > > >> > trunk[4]. :)
> > > >> >
> > > >> >
> > > >> >
> > > >> > [1]
> > > >> >
> > > >> >
> > > >>
> > >
> >
> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
> > > >> >
> > > >> > [2] http://tomee.apache.org/dynamic-datasource.html
> > > >> >
> > > >> > [3]
> > > >> >
> > > >> >
> > > >>
> > >
> >
> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
> > > >> >
> > > >> > [4]
> > > >> >
> > > >> >
> > > >>
> > >
> >
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
> > > >> >
> > > >>
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > Jean-Louis
> >
>



-- 
Jean-Louis

Re: Using TomEE/OpenEJB and failover of datasources

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
thanks Jean-Louis... i'm still learning via tomee (committers). :)


On Sun, Nov 3, 2013 at 10:00 AM, Jean-Louis MONTEIRO <je...@gmail.com>wrote:

> just as next time. If not already there, no issue to add a feature or to
> propose it by yourself ;-)
> New committers always welcome.
>
>
> 2013/11/3 Howard W. Smith, Jr. <sm...@gmail.com>
>
> > okay, i set it up as your post demonstrated, I tested already, and I see
> no
> > issues. it's time to test this in production. :)
> >
> > thanks romain! like i said in the other thread, I wish I knew about this
> > earlier.
> >
> >
> >
> > On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
> > smithh032772@gmail.com
> > > wrote:
> >
> > > So, the following replaces service-jar.xml (as per your post)?
> > >
> > > <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
> > >    router = failover-router
> > > </Resource>
> > >
> > > and if I wanted to use the 'strategy' parameter, I would add to
> Resource
> > > as demonstrated below?
> > >
> > > <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
> > >    router = failover-router
> > >    strategy = random
> > > </Resource>
> > >
> > >
> > >
> > >
> > > On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <
> > rmannibucau@gmail.com>wrote:
> > >
> > >> Hi
> > >>
> > >> Failover is native but to customiee the algo you can code anything you
> > >> want
> > >>
> > >> Tomee.xml is openejb.xml
> > >>
> > >> Service-jar.xml is today useless (see my post)
> > >> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <sm...@gmail.com>
> a
> > >> écrit :
> > >>
> > >> > First of all, thanks Romain for recommending the following, and for
> > >> that I
> > >> > will gladly start a new thread. :)
> > >> >
> > >> > TomEE/OpenEJB and failover of datasources[1]
> > >> >
> > >> > which references
> > >> >
> > >> > [OpenEJB] Dynamic Datasource[2]
> > >> >
> > >> > but I found the following  TomEE example:
> > >> >
> > >> > [TomEE] Dynamic Datasource Routing[3]
> > >> >
> > >> > So, before I begin, my questions are as follows:
> > >> >
> > >> > 1. I recognized that failover[1] says that the idea is to 'reuse'
> > >> dynamic
> > >> > datasource. Does this mean that we should code openejb[2] or
> tomee[3]
> > >> > dynamic datasource, first, and then reference accordingly via
> > >> failover[1]?
> > >> >
> > >> > 2. or failover[1] requires no coding on our part? only developer
> needs
> > >> to
> > >> > setup the failover 'config'?
> > >> >
> > >> > 3. also, tomee[3] dynamic datasource routing recommends openejb.xml
> > >> > (instead of tomee.xml). can openejb.xml cofiguration be placed in
> > >> > tomee.xml, too, or not?
> > >> >
> > >> > 4. okay, never mind, I was abouto ask for some clarification about
> > >> > META-INF/org.router/service-jar.xml, but I 'found' service-jar.xml
> on
> > >> > trunk[4]. :)
> > >> >
> > >> >
> > >> >
> > >> > [1]
> > >> >
> > >> >
> > >>
> >
> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
> > >> >
> > >> > [2] http://tomee.apache.org/dynamic-datasource.html
> > >> >
> > >> > [3]
> > >> >
> > >> >
> > >>
> >
> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
> > >> >
> > >> > [4]
> > >> >
> > >> >
> > >>
> >
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
> > >> >
> > >>
> > >
> > >
> >
>
>
>
> --
> Jean-Louis
>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
just as next time. If not already there, no issue to add a feature or to
propose it by yourself ;-)
New committers always welcome.


2013/11/3 Howard W. Smith, Jr. <sm...@gmail.com>

> okay, i set it up as your post demonstrated, I tested already, and I see no
> issues. it's time to test this in production. :)
>
> thanks romain! like i said in the other thread, I wish I knew about this
> earlier.
>
>
>
> On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <
> smithh032772@gmail.com
> > wrote:
>
> > So, the following replaces service-jar.xml (as per your post)?
> >
> > <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
> >    router = failover-router
> > </Resource>
> >
> > and if I wanted to use the 'strategy' parameter, I would add to Resource
> > as demonstrated below?
> >
> > <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
> >    router = failover-router
> >    strategy = random
> > </Resource>
> >
> >
> >
> >
> > On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <
> rmannibucau@gmail.com>wrote:
> >
> >> Hi
> >>
> >> Failover is native but to customiee the algo you can code anything you
> >> want
> >>
> >> Tomee.xml is openejb.xml
> >>
> >> Service-jar.xml is today useless (see my post)
> >> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <sm...@gmail.com> a
> >> écrit :
> >>
> >> > First of all, thanks Romain for recommending the following, and for
> >> that I
> >> > will gladly start a new thread. :)
> >> >
> >> > TomEE/OpenEJB and failover of datasources[1]
> >> >
> >> > which references
> >> >
> >> > [OpenEJB] Dynamic Datasource[2]
> >> >
> >> > but I found the following  TomEE example:
> >> >
> >> > [TomEE] Dynamic Datasource Routing[3]
> >> >
> >> > So, before I begin, my questions are as follows:
> >> >
> >> > 1. I recognized that failover[1] says that the idea is to 'reuse'
> >> dynamic
> >> > datasource. Does this mean that we should code openejb[2] or tomee[3]
> >> > dynamic datasource, first, and then reference accordingly via
> >> failover[1]?
> >> >
> >> > 2. or failover[1] requires no coding on our part? only developer needs
> >> to
> >> > setup the failover 'config'?
> >> >
> >> > 3. also, tomee[3] dynamic datasource routing recommends openejb.xml
> >> > (instead of tomee.xml). can openejb.xml cofiguration be placed in
> >> > tomee.xml, too, or not?
> >> >
> >> > 4. okay, never mind, I was abouto ask for some clarification about
> >> > META-INF/org.router/service-jar.xml, but I 'found' service-jar.xml on
> >> > trunk[4]. :)
> >> >
> >> >
> >> >
> >> > [1]
> >> >
> >> >
> >>
> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
> >> >
> >> > [2] http://tomee.apache.org/dynamic-datasource.html
> >> >
> >> > [3]
> >> >
> >> >
> >>
> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
> >> >
> >> > [4]
> >> >
> >> >
> >>
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
> >> >
> >>
> >
> >
>



-- 
Jean-Louis

Re: Using TomEE/OpenEJB and failover of datasources

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
okay, i set it up as your post demonstrated, I tested already, and I see no
issues. it's time to test this in production. :)

thanks romain! like i said in the other thread, I wish I knew about this
earlier.



On Sun, Nov 3, 2013 at 9:16 AM, Howard W. Smith, Jr. <smithh032772@gmail.com
> wrote:

> So, the following replaces service-jar.xml (as per your post)?
>
> <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
>    router = failover-router
> </Resource>
>
> and if I wanted to use the 'strategy' parameter, I would add to Resource
> as demonstrated below?
>
> <Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
>    router = failover-router
>    strategy = random
> </Resource>
>
>
>
>
> On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <rm...@gmail.com>wrote:
>
>> Hi
>>
>> Failover is native but to customiee the algo you can code anything you
>> want
>>
>> Tomee.xml is openejb.xml
>>
>> Service-jar.xml is today useless (see my post)
>> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <sm...@gmail.com> a
>> écrit :
>>
>> > First of all, thanks Romain for recommending the following, and for
>> that I
>> > will gladly start a new thread. :)
>> >
>> > TomEE/OpenEJB and failover of datasources[1]
>> >
>> > which references
>> >
>> > [OpenEJB] Dynamic Datasource[2]
>> >
>> > but I found the following  TomEE example:
>> >
>> > [TomEE] Dynamic Datasource Routing[3]
>> >
>> > So, before I begin, my questions are as follows:
>> >
>> > 1. I recognized that failover[1] says that the idea is to 'reuse'
>> dynamic
>> > datasource. Does this mean that we should code openejb[2] or tomee[3]
>> > dynamic datasource, first, and then reference accordingly via
>> failover[1]?
>> >
>> > 2. or failover[1] requires no coding on our part? only developer needs
>> to
>> > setup the failover 'config'?
>> >
>> > 3. also, tomee[3] dynamic datasource routing recommends openejb.xml
>> > (instead of tomee.xml). can openejb.xml cofiguration be placed in
>> > tomee.xml, too, or not?
>> >
>> > 4. okay, never mind, I was abouto ask for some clarification about
>> > META-INF/org.router/service-jar.xml, but I 'found' service-jar.xml on
>> > trunk[4]. :)
>> >
>> >
>> >
>> > [1]
>> >
>> >
>> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
>> >
>> > [2] http://tomee.apache.org/dynamic-datasource.html
>> >
>> > [3]
>> >
>> >
>> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
>> >
>> > [4]
>> >
>> >
>> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
>> >
>>
>
>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
So, the following replaces service-jar.xml (as per your post)?

<Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
   router = failover-router
</Resource>

and if I wanted to use the 'strategy' parameter, I would add to Resource as
demonstrated below?

<Resource id="jdbc/ds" type="DataSource" provider="RoutedDataSource">
   router = failover-router
   strategy = random
</Resource>




On Sun, Nov 3, 2013 at 8:58 AM, Romain Manni-Bucau <rm...@gmail.com>wrote:

> Hi
>
> Failover is native but to customiee the algo you can code anything you want
>
> Tomee.xml is openejb.xml
>
> Service-jar.xml is today useless (see my post)
> Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <sm...@gmail.com> a
> écrit :
>
> > First of all, thanks Romain for recommending the following, and for that
> I
> > will gladly start a new thread. :)
> >
> > TomEE/OpenEJB and failover of datasources[1]
> >
> > which references
> >
> > [OpenEJB] Dynamic Datasource[2]
> >
> > but I found the following  TomEE example:
> >
> > [TomEE] Dynamic Datasource Routing[3]
> >
> > So, before I begin, my questions are as follows:
> >
> > 1. I recognized that failover[1] says that the idea is to 'reuse' dynamic
> > datasource. Does this mean that we should code openejb[2] or tomee[3]
> > dynamic datasource, first, and then reference accordingly via
> failover[1]?
> >
> > 2. or failover[1] requires no coding on our part? only developer needs to
> > setup the failover 'config'?
> >
> > 3. also, tomee[3] dynamic datasource routing recommends openejb.xml
> > (instead of tomee.xml). can openejb.xml cofiguration be placed in
> > tomee.xml, too, or not?
> >
> > 4. okay, never mind, I was abouto ask for some clarification about
> > META-INF/org.router/service-jar.xml, but I 'found' service-jar.xml on
> > trunk[4]. :)
> >
> >
> >
> > [1]
> >
> >
> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
> >
> > [2] http://tomee.apache.org/dynamic-datasource.html
> >
> > [3]
> >
> >
> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
> >
> > [4]
> >
> >
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
> >
>

Re: Using TomEE/OpenEJB and failover of datasources

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

Failover is native but to customiee the algo you can code anything you want

Tomee.xml is openejb.xml

Service-jar.xml is today useless (see my post)
Le 3 nov. 2013 14:55, "Howard W. Smith, Jr." <sm...@gmail.com> a
écrit :

> First of all, thanks Romain for recommending the following, and for that I
> will gladly start a new thread. :)
>
> TomEE/OpenEJB and failover of datasources[1]
>
> which references
>
> [OpenEJB] Dynamic Datasource[2]
>
> but I found the following  TomEE example:
>
> [TomEE] Dynamic Datasource Routing[3]
>
> So, before I begin, my questions are as follows:
>
> 1. I recognized that failover[1] says that the idea is to 'reuse' dynamic
> datasource. Does this mean that we should code openejb[2] or tomee[3]
> dynamic datasource, first, and then reference accordingly via failover[1]?
>
> 2. or failover[1] requires no coding on our part? only developer needs to
> setup the failover 'config'?
>
> 3. also, tomee[3] dynamic datasource routing recommends openejb.xml
> (instead of tomee.xml). can openejb.xml cofiguration be placed in
> tomee.xml, too, or not?
>
> 4. okay, never mind, I was abouto ask for some clarification about
> META-INF/org.router/service-jar.xml, but I 'found' service-jar.xml on
> trunk[4]. :)
>
>
>
> [1]
>
> http://rmannibucau.wordpress.com/2013/04/26/tomeeopenejb-and-failover-of-datasources/
>
> [2] http://tomee.apache.org/dynamic-datasource.html
>
> [3]
>
> http://tomee.apache.org/examples-trunk/dynamic-datasource-routing/README.html
>
> [4]
>
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
>