Skip to content

Commit

Permalink
HikariCP
Browse files Browse the repository at this point in the history
  • Loading branch information
mbuechner committed May 3, 2022
1 parent f85e82b commit 62ad324
Show file tree
Hide file tree
Showing 17 changed files with 164 additions and 131 deletions.
175 changes: 103 additions & 72 deletions docs/dependencies.html

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions docs/dependency-info.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<!DOCTYPE html>
<!--
Generated by Apache Maven Doxia the 2022-05-02
Generated by Apache Maven Doxia the 2022-05-03
Rendered using Docs Maven Skin 2.0.8 (https://github.com/Bernardo-MG/docs-maven-skin)
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
Expand Down Expand Up @@ -133,7 +133,7 @@
<span class="navbar-toggler-icon"></span>
</button>

<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5</span> (<time id="navbar-date">2022-05-02</time>)</small>
<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5.2</span> (<time id="navbar-date">2022-05-03</time>)</small>
<div class="col-sm d-none d-md-block">
<a href="https://github.com/mbuechner/beagen" title="Github" aria-label="Github"><span class="navbar-icon fa fa-github pl-1" aria-hidden="true"></span> <span class="d-none d-sm-block d-md-none"> Github</span></a>
</div>
Expand Down Expand Up @@ -172,36 +172,36 @@ <h3 id="Apache-Maven">Apache Maven</h3>
<pre class="border shadow rounded"><code>&lt;dependency&gt;
&lt;groupId&gt;de.ddb.labs&lt;/groupId&gt;
&lt;artifactId&gt;beagen&lt;/artifactId&gt;
&lt;version&gt;1.5&lt;/version&gt;
&lt;version&gt;1.5.2&lt;/version&gt;
&lt;/dependency&gt;</code></pre>
</section>
<section>
<h3 id="Apache-Buildr">Apache Buildr</h3>
<pre class="border shadow rounded"><code>'de.ddb.labs:beagen:jar:1.5'</code></pre>
<pre class="border shadow rounded"><code>'de.ddb.labs:beagen:jar:1.5.2'</code></pre>
</section>
<section>
<h3 id="Apache-Ivy">Apache Ivy</h3>
<pre class="border shadow rounded"><code>&lt;dependency org="de.ddb.labs" name="beagen" rev="1.5"&gt;
<pre class="border shadow rounded"><code>&lt;dependency org="de.ddb.labs" name="beagen" rev="1.5.2"&gt;
&lt;artifact name="beagen" type="jar" /&gt;
&lt;/dependency&gt;</code></pre>
</section>
<section>
<h3 id="Groovy-Grape">Groovy Grape</h3>
<pre class="border shadow rounded"><code>@Grapes(
@Grab(group='de.ddb.labs', module='beagen', version='1.5')
@Grab(group='de.ddb.labs', module='beagen', version='1.5.2')
)</code></pre>
</section>
<section>
<h3 id="GradleGrails">Gradle/Grails</h3>
<pre class="border shadow rounded"><code>compile 'de.ddb.labs:beagen:1.5'</code></pre>
<pre class="border shadow rounded"><code>compile 'de.ddb.labs:beagen:1.5.2'</code></pre>
</section>
<section>
<h3 id="Scala-SBT">Scala SBT</h3>
<pre class="border shadow rounded"><code>libraryDependencies += "de.ddb.labs" % "beagen" % "1.5"</code></pre>
<pre class="border shadow rounded"><code>libraryDependencies += "de.ddb.labs" % "beagen" % "1.5.2"</code></pre>
</section>
<section>
<h3 id="Leiningen">Leiningen</h3>
<pre class="border shadow rounded"><code>[de.ddb.labs/beagen "1.5"]</code></pre>
<pre class="border shadow rounded"><code>[de.ddb.labs/beagen "1.5.2"]</code></pre>
</section>
</section>
</section>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<!DOCTYPE html>
<!--
Generated by Apache Maven Doxia the 2022-05-02
Generated by Apache Maven Doxia the 2022-05-03
Rendered using Docs Maven Skin 2.0.8 (https://github.com/Bernardo-MG/docs-maven-skin)
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
Expand Down Expand Up @@ -133,7 +133,7 @@
<span class="navbar-toggler-icon"></span>
</button>

<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5</span> (<time id="navbar-date">2022-05-02</time>)</small>
<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5.2</span> (<time id="navbar-date">2022-05-03</time>)</small>
<div class="col-sm d-none d-md-block">
<a href="https://github.com/mbuechner/beagen" title="Github" aria-label="Github"><span class="navbar-icon fa fa-github pl-1" aria-hidden="true"></span> <span class="d-none d-sm-block d-md-none"> Github</span></a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/issue-management.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<!DOCTYPE html>
<!--
Generated by Apache Maven Doxia the 2022-05-02
Generated by Apache Maven Doxia the 2022-05-03
Rendered using Docs Maven Skin 2.0.8 (https://github.com/Bernardo-MG/docs-maven-skin)
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
Expand Down Expand Up @@ -133,7 +133,7 @@
<span class="navbar-toggler-icon"></span>
</button>

<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5</span> (<time id="navbar-date">2022-05-02</time>)</small>
<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5.2</span> (<time id="navbar-date">2022-05-03</time>)</small>
<div class="col-sm d-none d-md-block">
<a href="https://github.com/mbuechner/beagen" title="Github" aria-label="Github"><span class="navbar-icon fa fa-github pl-1" aria-hidden="true"></span> <span class="d-none d-sm-block d-md-none"> Github</span></a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/licenses.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<!DOCTYPE html>
<!--
Generated by Apache Maven Doxia the 2022-05-02
Generated by Apache Maven Doxia the 2022-05-03
Rendered using Docs Maven Skin 2.0.8 (https://github.com/Bernardo-MG/docs-maven-skin)
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
Expand Down Expand Up @@ -133,7 +133,7 @@
<span class="navbar-toggler-icon"></span>
</button>

<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5</span> (<time id="navbar-date">2022-05-02</time>)</small>
<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5.2</span> (<time id="navbar-date">2022-05-03</time>)</small>
<div class="col-sm d-none d-md-block">
<a href="https://github.com/mbuechner/beagen" title="Github" aria-label="Github"><span class="navbar-icon fa fa-github pl-1" aria-hidden="true"></span> <span class="d-none d-sm-block d-md-none"> Github</span></a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/plugin-management.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<!DOCTYPE html>
<!--
Generated by Apache Maven Doxia the 2022-05-02
Generated by Apache Maven Doxia the 2022-05-03
Rendered using Docs Maven Skin 2.0.8 (https://github.com/Bernardo-MG/docs-maven-skin)
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
Expand Down Expand Up @@ -133,7 +133,7 @@
<span class="navbar-toggler-icon"></span>
</button>

<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5</span> (<time id="navbar-date">2022-05-02</time>)</small>
<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5.2</span> (<time id="navbar-date">2022-05-03</time>)</small>
<div class="col-sm d-none d-md-block">
<a href="https://github.com/mbuechner/beagen" title="Github" aria-label="Github"><span class="navbar-icon fa fa-github pl-1" aria-hidden="true"></span> <span class="d-none d-sm-block d-md-none"> Github</span></a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/plugins.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<!DOCTYPE html>
<!--
Generated by Apache Maven Doxia the 2022-05-02
Generated by Apache Maven Doxia the 2022-05-03
Rendered using Docs Maven Skin 2.0.8 (https://github.com/Bernardo-MG/docs-maven-skin)
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
Expand Down Expand Up @@ -133,7 +133,7 @@
<span class="navbar-toggler-icon"></span>
</button>

<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5</span> (<time id="navbar-date">2022-05-02</time>)</small>
<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5.2</span> (<time id="navbar-date">2022-05-03</time>)</small>
<div class="col-sm d-none d-md-block">
<a href="https://github.com/mbuechner/beagen" title="Github" aria-label="Github"><span class="navbar-icon fa fa-github pl-1" aria-hidden="true"></span> <span class="d-none d-sm-block d-md-none"> Github</span></a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/project-info.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<!DOCTYPE html>
<!--
Generated by Apache Maven Doxia the 2022-05-02
Generated by Apache Maven Doxia the 2022-05-03
Rendered using Docs Maven Skin 2.0.8 (https://github.com/Bernardo-MG/docs-maven-skin)
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
Expand Down Expand Up @@ -133,7 +133,7 @@
<span class="navbar-toggler-icon"></span>
</button>

<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5</span> (<time id="navbar-date">2022-05-02</time>)</small>
<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5.2</span> (<time id="navbar-date">2022-05-03</time>)</small>
<div class="col-sm d-none d-md-block">
<a href="https://github.com/mbuechner/beagen" title="Github" aria-label="Github"><span class="navbar-icon fa fa-github pl-1" aria-hidden="true"></span> <span class="d-none d-sm-block d-md-none"> Github</span></a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/scm.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<!DOCTYPE html>
<!--
Generated by Apache Maven Doxia the 2022-05-02
Generated by Apache Maven Doxia the 2022-05-03
Rendered using Docs Maven Skin 2.0.8 (https://github.com/Bernardo-MG/docs-maven-skin)
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
Expand Down Expand Up @@ -133,7 +133,7 @@
<span class="navbar-toggler-icon"></span>
</button>

<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5</span> (<time id="navbar-date">2022-05-02</time>)</small>
<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5.2</span> (<time id="navbar-date">2022-05-03</time>)</small>
<div class="col-sm d-none d-md-block">
<a href="https://github.com/mbuechner/beagen" title="Github" aria-label="Github"><span class="navbar-icon fa fa-github pl-1" aria-hidden="true"></span> <span class="d-none d-sm-block d-md-none"> Github</span></a>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<!DOCTYPE html>
<!--
Generated by Apache Maven Doxia the 2022-05-02
Generated by Apache Maven Doxia the 2022-05-03
Rendered using Docs Maven Skin 2.0.8 (https://github.com/Bernardo-MG/docs-maven-skin)
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
Expand Down Expand Up @@ -133,7 +133,7 @@
<span class="navbar-toggler-icon"></span>
</button>

<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5</span> (<time id="navbar-date">2022-05-02</time>)</small>
<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5.2</span> (<time id="navbar-date">2022-05-03</time>)</small>
<div class="col-sm d-none d-md-block">
<a href="https://github.com/mbuechner/beagen" title="Github" aria-label="Github"><span class="navbar-icon fa fa-github pl-1" aria-hidden="true"></span> <span class="d-none d-sm-block d-md-none"> Github</span></a>
</div>
Expand Down Expand Up @@ -235,7 +235,7 @@ <h2 id="Build-Information">Build Information</h2>
</tr>
<tr>
<td align="left">Version</td>
<td>1.5</td>
<td>1.5.2</td>
</tr>
<tr>
<td align="left">Type</td>
Expand Down
4 changes: 2 additions & 2 deletions docs/team.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<!DOCTYPE html>
<!--
Generated by Apache Maven Doxia the 2022-05-02
Generated by Apache Maven Doxia the 2022-05-03
Rendered using Docs Maven Skin 2.0.8 (https://github.com/Bernardo-MG/docs-maven-skin)
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
Expand Down Expand Up @@ -133,7 +133,7 @@
<span class="navbar-toggler-icon"></span>
</button>

<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5</span> (<time id="navbar-date">2022-05-02</time>)</small>
<small class="navbar-text d-none d-md-block"><span id="navbar-version">1.5.2</span> (<time id="navbar-date">2022-05-03</time>)</small>
<div class="col-sm d-none d-md-block">
<a href="https://github.com/mbuechner/beagen" title="Github" aria-label="Github"><span class="navbar-icon fa fa-github pl-1" aria-hidden="true"></span> <span class="d-none d-sm-block d-md-none"> Github</span></a>
</div>
Expand Down
16 changes: 7 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.ddb.labs</groupId>
<artifactId>beagen</artifactId>
<version>1.5</version>
<version>1.5.2</version>
<packaging>jar</packaging>
<name>Beagen</name>
<description>Ein BEACON-Datei-Generator für die Deutsche Digitale Bibliothek.</description>
Expand Down Expand Up @@ -89,22 +89,21 @@
<version>2.3.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.2.Final</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.6.8.Final</version>
</dependency>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>5.6.8.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-hikaricp</artifactId>
<version>5.6.8.Final</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
Expand All @@ -115,7 +114,6 @@
<artifactId>okhttp</artifactId>
<version>4.9.3</version>
</dependency>

</dependencies>
<reporting>
<plugins>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/ddb/labs/beagen/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static void main(String[] args) throws Exception {
.withSchedule(CronScheduleBuilder.cronSchedule(Configuration.get().getValue(BEAGEN_CRON)))
.build();

quartzScheduler = new StdSchedulerFactory().getDefaultScheduler();
quartzScheduler = StdSchedulerFactory.getDefaultScheduler();
quartzScheduler.start();
quartzScheduler.scheduleJob(job, trigger);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public static BeaconFile getBeaconFile(long id) {
return null;
} finally {
tx.commit();
em.close();
}
}

Expand Down Expand Up @@ -97,7 +98,7 @@ public static List<BeaconFile> getBeaconFiles(TYPE type, boolean onlyLatest) {
}

final EntityManager em = EntityManagerUtil.getInstance().getEntityManager();
final EntityTransaction tx = EntityManagerUtil.getInstance().getEntityTransaction();
final EntityTransaction tx = em.getTransaction();
tx.begin();
try {
final Query q2 = em.createQuery(qs, BeaconFile.class);
Expand All @@ -117,6 +118,7 @@ public static List<BeaconFile> getBeaconFiles(TYPE type, boolean onlyLatest) {
return new ArrayList<>();
} finally {
tx.commit();
em.close();
}
}

Expand Down Expand Up @@ -158,6 +160,7 @@ public static List<BeaconFile> getBeaconFiles(TYPE type, SECTOR sector, boolean
return new ArrayList<>();
} finally {
tx.commit();
em.close();
}

}
Expand Down Expand Up @@ -194,6 +197,7 @@ public static Date getLastDate(TYPE type) {
return null;
} finally {
tx.commit();
em.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ public class EntityManagerUtil {

private static EntityManagerUtil instance;
private final EntityManagerFactory EMF;
private final EntityManager EM;

private EntityManagerUtil() {
EMF = Persistence.createEntityManagerFactory("BeagenFile");
EM = EMF.createEntityManager();
}

public static synchronized EntityManagerUtil getInstance() {
Expand All @@ -43,17 +41,10 @@ public static synchronized EntityManagerUtil getInstance() {
}

public EntityManager getEntityManager() {
return EM;
}

public EntityTransaction getEntityTransaction() {
return getInstance().getEntityManager().getTransaction();
return EMF.createEntityManager();
}

public void shutdown() {
if (EM != null) {
EM.close();
}
if (EMF != null) {
EMF.close();
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/de/ddb/labs/beagen/backend/jobs/BeaconJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public void executeNewspapers(Date date) {
tx.begin();
em.persist(bf);
tx.commit();
em.close();
} else {
LOG.warn("Beacon file {}/{} generated is equal to last beacon file in database, so it was NOT written to database.", TYPE.NEWSPAPER, SECTOR.ALL);
}
Expand Down Expand Up @@ -255,6 +256,7 @@ public void execute(TYPE type, SECTOR[] sectors, Date date) {
tx.begin();
em.persist(files_sector);
tx.commit();
em.close();
} else {
LOG.warn("Beacon file {}/{} generated is equal to last beacon file in database, so it was NOT written to database.", type, sector);
}
Expand Down
Loading

0 comments on commit 62ad324

Please sign in to comment.