knowm / Yank

Ultra-Light JDBC Persistance Layer
http://knowm.org/open-source/yank/
Apache License 2.0
132 stars 16 forks source link

hikari 2.4.1, compatibility Patch shutdown() to close() #27

Closed lewie closed 9 years ago

lewie commented 9 years ago

Hy @timmolter,

diff --git a/src/main/java/com/xeiam/yank/YankPoolManager.java b/src/main/java/com/xeiam/yank/YankPoolManager.java
index da3d4e5..f374d7d 100644
--- a/src/main/java/com/xeiam/yank/YankPoolManager.java
+++ b/src/main/java/com/xeiam/yank/YankPoolManager.java
@@ -90,7 +90,7 @@

     if (this.hikariDataSource != null) {
       logger.info("Releasing pool: {}...", this.hikariDataSource.getPoolName());
-      this.hikariDataSource.shutdown();
+      this.hikariDataSource.close();
     }
   }

then pom.xml dependency can be changed too: from:

        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP-java6</artifactId>
            <version>2.3.9</version>
            <scope>compile</scope>
        </dependency>

to:

        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <version>2.4.1</version>
            <scope>compile</scope>
        </dependency>

A small issue I've found in examples MYSQL_SQL.properties too:

BOOKS_CREATE_TABLE=CREATE TABLE `Books` ...

should be changed to:

BOOKS_CREATE_TABLE=CREATE TABLE `BOOKS` ...

I tested with Mysql, and got an error: 'BOOKS' could not be found.

Thank you very much. Helmut

lewie commented 9 years ago

Hello @timmolter, I want to use Yank in a JDBC Bundle for https://github.com/openhab/openhab. Will the project be continued?

timmolter commented 9 years ago

@lewie Sorry, somehow I missed you issue/question before. Let me answer it next...

timmolter commented 9 years ago

OK, I updated all dependencies in the pom and fixed the BOOKS string. Please see/use latest snapshot jar. If you need a release jar let me know.

Are you saying this.hikariDataSource.shutdown(); should be replaced with this.hikariDataSource.close();?

If so, why?

timmolter commented 9 years ago

BTW, I'm sticking to HikariCP-java6 rather than HikariCP in order to keep Yank compatible with Java 6. If that's an issue, let me know also please.

timmolter commented 9 years ago

openhab looks awesome. I may end up using it as I'm starting to get into that application space with artificial intelligence stuff like anomaly detection, prediction, robotics. Glad you made me aware of it!

lewie commented 9 years ago

@timmolter, yes, it is a java Version Problem, forgot to say. We need compatibility with minimum java 7, better java 8 (upcomming openHAB2 aka since openhab2 core Components now named smarthome) and for HikariCP 2.4.1 hikariDataSource.close() needs to be used. In Source of HikariCP 2.4.1 it is @Deprecated only, but (don't know why) I got errors running HikariCP 2.4.1 and Yank together.

After going through Mybatis I landed at HikariCP, after many more hours of research at Yank what my work has facilitated again. I am also thinking of the developers who want to maintain the JDBC Bundle further. (its not merged yet)

Wahh, anomaly detection, prediction... You're running an open door for me!!! I use openHAB/SmartHome more and more for really everything to log, manage, eventing...., not only in Smarthomes. I take care of a few smaller companies, make them smarter, their consumption and material movements (Electricity, Air, Oil, Gas, Wood chips) more transparent. Complex machines seams to have on the let any peculiarity to identify it through a power supply system.

For example, I would like to identify, a current Power consumer at its 'switch on Power profile' or can identify at its load profile. Complex and simple Machines too seems to have this Profile, but can't describe it properly for a pattern recognition. The deep mathematical understanding is missing me, unfortunately, in these areas often.

Nice to meet you Helmut

timmolter commented 9 years ago

@lewie OK, I updated Yank for you and bumped the version to 3.1.0-SNAPSHOT. Let me know. If everything works for you, I'll do a release to Maven Central.

lewie commented 9 years ago

@timmolter, Perfect! Everything works for me now. A release on Maven Central would be absolutely perfect! :+1:

Thank You Helmut

timmolter commented 9 years ago

3.1.0 pushed to Maven Central. Notice the namespace change:

<dependency>
    <groupId>org.knowm</groupId>
    <artifactId>yank</artifactId>
    <version>3.1.0</version>
</dependency>