[KEYCLOAK-17208] - Upgrade Quarkus 1.13.3.Final

This commit is contained in:
Pedro Igor 2021-04-29 10:16:15 -03:00
parent b75648bda2
commit 2c09f4d205
2 changed files with 27 additions and 31 deletions

View file

@ -31,13 +31,13 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<quarkus.version>1.13.2.Final</quarkus.version> <quarkus.version>1.13.3.Final</quarkus.version>
<resteasy.version>4.5.9.Final</resteasy.version> <resteasy.version>4.5.9.Final</resteasy.version>
<jackson.version>2.12.1</jackson.version> <jackson.version>2.12.1</jackson.version>
<jackson.databind.version>${jackson.version}</jackson.databind.version> <jackson.databind.version>${jackson.version}</jackson.databind.version>
<hibernate.version>5.4.29.Final</hibernate.version> <hibernate.version>5.4.29.Final</hibernate.version>
<mysql-connector-java.version>8.0.23</mysql-connector-java.version> <mysql-connector-java.version>8.0.24</mysql-connector-java.version>
<postgresql.version>42.2.19</postgresql.version> <postgresql.version>42.2.20</postgresql.version>
<picocli.version>4.6.1</picocli.version> <picocli.version>4.6.1</picocli.version>
<snakeyaml.version>1.28</snakeyaml.version> <snakeyaml.version>1.28</snakeyaml.version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version> <surefire-plugin.version>3.0.0-M5</surefire-plugin.version>

View file

@ -113,7 +113,29 @@ public final class QuarkusJpaConnectionProviderFactory implements JpaConnectionP
@Override @Override
public void postInit(KeycloakSessionFactory factory) { public void postInit(KeycloakSessionFactory factory) {
this.factory = factory; this.factory = factory;
lazyInit(); Instance<EntityManagerFactory> instance = CDI.current().select(EntityManagerFactory.class);
if (!instance.isResolvable()) {
throw new RuntimeException("Failed to resolve " + EntityManagerFactory.class + " from Quarkus runtime");
}
emf = instance.get();
KeycloakSession session = factory.create();
boolean initSchema;
try (Connection connection = getConnection()) {
createOperationalInfo(connection);
initSchema = createOrUpdateSchema(getSchema(), connection, session);
} catch (SQLException cause) {
throw new RuntimeException("Failed to update database.", cause);
} finally {
session.close();
}
if (initSchema) {
runJobInTransaction(factory, this::initSchemaOrExport);
}
} }
@Override @Override
@ -156,32 +178,6 @@ public final class QuarkusJpaConnectionProviderFactory implements JpaConnectionP
} }
} }
private void lazyInit() {
Instance<EntityManagerFactory> instance = CDI.current().select(EntityManagerFactory.class);
if (!instance.isResolvable()) {
throw new RuntimeException("Failed to resolve " + EntityManagerFactory.class + " from Quarkus runtime");
}
emf = instance.get();
KeycloakSession session = factory.create();
boolean initSchema;
try (Connection connection = getConnection()) {
logDatabaseConnectionInfo(connection);
initSchema = createOrUpdateSchema(getSchema(), connection, session);
} catch (SQLException cause) {
throw new RuntimeException("Failed to update database.", cause);
} finally {
session.close();
}
if (initSchema) {
runJobInTransaction(factory, this::initSchemaOrExport);
}
}
private void initSchemaOrExport(KeycloakSession session) { private void initSchemaOrExport(KeycloakSession session) {
ExportImportManager exportImportManager = new ExportImportManager(session); ExportImportManager exportImportManager = new ExportImportManager(session);
@ -396,7 +392,7 @@ public final class QuarkusJpaConnectionProviderFactory implements JpaConnectionP
return new File(databaseUpdateFile); return new File(databaseUpdateFile);
} }
private void logDatabaseConnectionInfo(Connection connection) { private void createOperationalInfo(Connection connection) {
try { try {
operationalInfo = new LinkedHashMap<>(); operationalInfo = new LinkedHashMap<>();
DatabaseMetaData md = connection.getMetaData(); DatabaseMetaData md = connection.getMetaData();