HikariCp to set JtaManaged

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

HikariCp to set JtaManaged

Kalyan
Hello,
Does Hikari supports JTA ?

In the openejb how can i set to JtaManaged = true for the HikariCP?

p.put("DS1",
"new://Resource?type=javax.sql.DataSource&class-name=org.superbiz.ConnectionPoolFactory&factory-name=create");
        p.put("DS1.JdbcDriver", "oracle.jdbc.OracleDriver");
        p.put("DS1.JdbcUrl", "jdbc:oracle:thin:@xxxxxx1521/rwdb");
        p.put("DS1.UserName", "admin");
        p.put("DS1.Password", "xxxxxx");
        p.put("DS1.LogSql", "true");
        p.put("DS1.JtaManaged", "true");

Even though i set to true. Looks like its ignored.

WARN - unused property 'JtaManaged' for resource 'DS1'



public class ConnectionPoolFactory {
    private Properties properties;
    public Properties getProperties() {
        return properties;
    }
    public void setProperties(final Properties properties) {
        this.properties = properties;
    }

    public Object create() {
            HikariConfig hikariConfig = new HikariConfig();
            int connIdleTimeInMinutes = 10;
            int connWaitTimeInMilliSec = 1000;
            // Initialize connection pool
           
hikariConfig.setPoolName(properties.getProperty("HikariDS.PoolName"));
            hikariConfig.setJdbcUrl(properties.getProperty("JdbcUrl"));
            hikariConfig.setAutoCommit(false);
            hikariConfig.setUsername(properties.getProperty("Username"));
            hikariConfig.setPassword(properties.getProperty("Password"));
           
hikariConfig.setMaximumPoolSize(Integer.parseInt(properties.getProperty("MaximumPoolSize",
"20")));
           
hikariConfig.setMinimumIdle(Integer.parseInt(properties.getProperty("MinimumIdle",
"20")));
            hikariConfig.setIdleTimeout(connIdleTimeInMinutes * 60 * 1000);
            hikariConfig.setConnectionTimeout(connWaitTimeInMilliSec);
            HikariDataSource resource = new HikariDataSource(hikariConfig);
            return resource;
    }
}


Due to this the transactions are not performing. As it suppose to.
Please help me with this.

thanks
Kalyan



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
Reply | Threaded
Open this post in threaded view
|

Re: HikariCp to set JtaManaged

jgallimore
We'll need to wire it into a ManagedConnection. Not sure how to do that off
the top of my head, but I'm working in that area on Monday, so I'll help
you out.

Jon

On Fri, 28 Jun 2019, 22:18 Kalyan, <[hidden email]> wrote:

> Hello,
> Does Hikari supports JTA ?
>
> In the openejb how can i set to JtaManaged = true for the HikariCP?
>
> p.put("DS1",
>
> "new://Resource?type=javax.sql.DataSource&class-name=org.superbiz.ConnectionPoolFactory&factory-name=create");
>         p.put("DS1.JdbcDriver", "oracle.jdbc.OracleDriver");
>         p.put("DS1.JdbcUrl", "jdbc:oracle:thin:@xxxxxx1521/rwdb");
>         p.put("DS1.UserName", "admin");
>         p.put("DS1.Password", "xxxxxx");
>         p.put("DS1.LogSql", "true");
>         p.put("DS1.JtaManaged", "true");
>
> Even though i set to true. Looks like its ignored.
>
> WARN - unused property 'JtaManaged' for resource 'DS1'
>
>
>
> public class ConnectionPoolFactory {
>     private Properties properties;
>     public Properties getProperties() {
>         return properties;
>     }
>     public void setProperties(final Properties properties) {
>         this.properties = properties;
>     }
>
>     public Object create() {
>             HikariConfig hikariConfig = new HikariConfig();
>             int connIdleTimeInMinutes = 10;
>             int connWaitTimeInMilliSec = 1000;
>             // Initialize connection pool
>
> hikariConfig.setPoolName(properties.getProperty("HikariDS.PoolName"));
>             hikariConfig.setJdbcUrl(properties.getProperty("JdbcUrl"));
>             hikariConfig.setAutoCommit(false);
>             hikariConfig.setUsername(properties.getProperty("Username"));
>             hikariConfig.setPassword(properties.getProperty("Password"));
>
>
> hikariConfig.setMaximumPoolSize(Integer.parseInt(properties.getProperty("MaximumPoolSize",
> "20")));
>
>
> hikariConfig.setMinimumIdle(Integer.parseInt(properties.getProperty("MinimumIdle",
> "20")));
>             hikariConfig.setIdleTimeout(connIdleTimeInMinutes * 60 * 1000);
>             hikariConfig.setConnectionTimeout(connWaitTimeInMilliSec);
>             HikariDataSource resource = new HikariDataSource(hikariConfig);
>             return resource;
>     }
> }
>
>
> Due to this the transactions are not performing. As it suppose to.
> Please help me with this.
>
> thanks
> Kalyan
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
>
Reply | Threaded
Open this post in threaded view
|

Re: HikariCp to set JtaManaged

Jean-Louis MONTEIRO
Our DataSourceFactory does not have support for this kind of DataSource

In addition to Tomcat, DBCP1, and DBCP2, we have BoneCP.
The amount of work is not huge, but it's not supported out of the box
--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com


On Sat, Jun 29, 2019 at 10:30 PM Jonathan Gallimore <
[hidden email]> wrote:

> We'll need to wire it into a ManagedConnection. Not sure how to do that off
> the top of my head, but I'm working in that area on Monday, so I'll help
> you out.
>
> Jon
>
> On Fri, 28 Jun 2019, 22:18 Kalyan, <[hidden email]> wrote:
>
> > Hello,
> > Does Hikari supports JTA ?
> >
> > In the openejb how can i set to JtaManaged = true for the HikariCP?
> >
> > p.put("DS1",
> >
> >
> "new://Resource?type=javax.sql.DataSource&class-name=org.superbiz.ConnectionPoolFactory&factory-name=create");
> >         p.put("DS1.JdbcDriver", "oracle.jdbc.OracleDriver");
> >         p.put("DS1.JdbcUrl", "jdbc:oracle:thin:@xxxxxx1521/rwdb");
> >         p.put("DS1.UserName", "admin");
> >         p.put("DS1.Password", "xxxxxx");
> >         p.put("DS1.LogSql", "true");
> >         p.put("DS1.JtaManaged", "true");
> >
> > Even though i set to true. Looks like its ignored.
> >
> > WARN - unused property 'JtaManaged' for resource 'DS1'
> >
> >
> >
> > public class ConnectionPoolFactory {
> >     private Properties properties;
> >     public Properties getProperties() {
> >         return properties;
> >     }
> >     public void setProperties(final Properties properties) {
> >         this.properties = properties;
> >     }
> >
> >     public Object create() {
> >             HikariConfig hikariConfig = new HikariConfig();
> >             int connIdleTimeInMinutes = 10;
> >             int connWaitTimeInMilliSec = 1000;
> >             // Initialize connection pool
> >
> > hikariConfig.setPoolName(properties.getProperty("HikariDS.PoolName"));
> >             hikariConfig.setJdbcUrl(properties.getProperty("JdbcUrl"));
> >             hikariConfig.setAutoCommit(false);
> >             hikariConfig.setUsername(properties.getProperty("Username"));
> >             hikariConfig.setPassword(properties.getProperty("Password"));
> >
> >
> >
> hikariConfig.setMaximumPoolSize(Integer.parseInt(properties.getProperty("MaximumPoolSize",
> > "20")));
> >
> >
> >
> hikariConfig.setMinimumIdle(Integer.parseInt(properties.getProperty("MinimumIdle",
> > "20")));
> >             hikariConfig.setIdleTimeout(connIdleTimeInMinutes * 60 *
> 1000);
> >             hikariConfig.setConnectionTimeout(connWaitTimeInMilliSec);
> >             HikariDataSource resource = new
> HikariDataSource(hikariConfig);
> >             return resource;
> >     }
> > }
> >
> >
> > Due to this the transactions are not performing. As it suppose to.
> > Please help me with this.
> >
> > thanks
> > Kalyan
> >
> >
> >
> > --
> > Sent from:
> > http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
> >
>
   --
    Jean-Louis Monteiro
    http://twitter.com/jlouismonteiro
    http://www.tomitribe.com