Compare commits
9 Commits
e07b5037db
...
52c3f2c5f1
Author | SHA1 | Date |
---|---|---|
Guillaume Smet | 52c3f2c5f1 | |
Guillaume Smet | 3536fe9926 | |
Guillaume Smet | 500638fdab | |
Sergey Beryozkin | 2f0656ac6c | |
Alexey Loubyansky | 11e1e861f7 | |
dependabot[bot] | 5dfee0e8e9 | |
dependabot[bot] | 5ec582abd7 | |
Guillaume Smet | 368e3dc81d | |
Guillaume Smet | 96d27a1532 |
|
@ -119,7 +119,7 @@
|
|||
<slf4j-jboss-logmanager.version>2.0.0.Final</slf4j-jboss-logmanager.version>
|
||||
<wildfly-common.version>1.7.0.Final</wildfly-common.version>
|
||||
<wildfly-client-config.version>1.0.1.Final</wildfly-client-config.version>
|
||||
<wildfly-elytron.version>2.4.1.Final</wildfly-elytron.version>
|
||||
<wildfly-elytron.version>2.4.2.Final</wildfly-elytron.version>
|
||||
<jboss-marshalling.version>2.1.4.SP1</jboss-marshalling.version>
|
||||
<jboss-threads.version>3.6.1.Final</jboss-threads.version>
|
||||
<vertx.version>4.5.7</vertx.version>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
plugins {
|
||||
id("com.gradle.develocity") version "3.17.3"
|
||||
id("com.gradle.develocity") version "3.17.4"
|
||||
}
|
||||
|
||||
develocity {
|
||||
|
|
|
@ -543,7 +543,7 @@ All <<extensions-and-database-drivers-reference,supported JDBC drivers do>>,
|
|||
but <<other-databases,other JDBC drivers>> might not.
|
||||
. Make sure your database server is configured to enable XA.
|
||||
. Enable XA support explicitly for each relevant datasource by setting
|
||||
<<quarkus-agroal_quarkus-datasource-jdbc-transactions,`quarkus.datasource[.optional name].transactions`>> to `xa`.
|
||||
<<quarkus-agroal_quarkus-datasource-jdbc-transactions,`quarkus.datasource[.optional name].jdbc.transactions`>> to `xa`.
|
||||
|
||||
Using XA, a rollback in one datasource will trigger a rollback in every other datasource enrolled in the transaction.
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.quarkus.jdbc.oracle.deployment;
|
|||
|
||||
import io.quarkus.deployment.annotations.BuildProducer;
|
||||
import io.quarkus.deployment.annotations.BuildStep;
|
||||
import io.quarkus.deployment.builditem.AdditionalIndexedClassesBuildItem;
|
||||
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
|
||||
|
||||
/**
|
||||
|
@ -14,7 +15,8 @@ public final class OracleNativeImage {
|
|||
* by reflection, as commonly expected.
|
||||
*/
|
||||
@BuildStep
|
||||
void reflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
|
||||
void reflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
|
||||
BuildProducer<AdditionalIndexedClassesBuildItem> additionalIndexedClasses) {
|
||||
//Not strictly necessary when using Agroal, as it also registers
|
||||
//any JDBC driver being configured explicitly through its configuration.
|
||||
//We register it for the sake of people not using Agroal.
|
||||
|
@ -23,6 +25,10 @@ public final class OracleNativeImage {
|
|||
final String driverName = "oracle.jdbc.driver.OracleDriver";
|
||||
reflectiveClass.produce(ReflectiveClassBuildItem.builder(driverName).build());
|
||||
|
||||
// This is needed when using XA and we use the `@RegisterForReflection` trick to make sure all nested classes are registered for reflection
|
||||
additionalIndexedClasses
|
||||
.produce(new AdditionalIndexedClassesBuildItem("io.quarkus.jdbc.oracle.runtime.graal.OracleReflections"));
|
||||
|
||||
// for ldap style jdbc urls. e.g. jdbc:oracle:thin:@ldap://oid:5000/mydb1,cn=OracleContext,dc=myco,dc=com
|
||||
//
|
||||
// Note that all JDK provided InitialContextFactory impls from the JDK registered via module descriptors
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package io.quarkus.jdbc.oracle.runtime.graal;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
/**
|
||||
* We don't use a build item here as we also need to register all the nested classes and there's no way to do it easily with the
|
||||
* build item for now.
|
||||
*/
|
||||
@RegisterForReflection(targets = { oracle.jdbc.xa.OracleXADataSource.class,
|
||||
oracle.jdbc.datasource.impl.OracleDataSource.class })
|
||||
public class OracleReflections {
|
||||
|
||||
}
|
|
@ -8,9 +8,14 @@ import java.nio.file.NoSuchFileException;
|
|||
import java.nio.file.Path;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.concurrent.Phaser;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
@ -41,6 +46,8 @@ public class WorkspaceLoader implements WorkspaceModelResolver, WorkspaceReader
|
|||
|
||||
private static final String POM_XML = "pom.xml";
|
||||
|
||||
private static final Model MISSING_MODEL = new Model();
|
||||
|
||||
private static Path locateCurrentProjectPom(Path path) throws BootstrapMavenException {
|
||||
Path p = path;
|
||||
while (p != null) {
|
||||
|
@ -53,11 +60,11 @@ public class WorkspaceLoader implements WorkspaceModelResolver, WorkspaceReader
|
|||
throw new BootstrapMavenException("Failed to locate project pom.xml for " + path);
|
||||
}
|
||||
|
||||
private final List<RawModule> moduleQueue = new ArrayList<>();
|
||||
private final Map<Path, Model> loadedPoms = new HashMap<>();
|
||||
private final Deque<RawModule> moduleQueue = new ConcurrentLinkedDeque<>();
|
||||
private final Map<Path, Model> loadedPoms = new ConcurrentHashMap<>();
|
||||
|
||||
private final Function<Path, Model> modelProvider;
|
||||
private final Map<GAV, Model> loadedModules = new HashMap<>();
|
||||
private final Map<GAV, Model> loadedModules = new ConcurrentHashMap<>();
|
||||
|
||||
private final LocalWorkspace workspace = new LocalWorkspace();
|
||||
private final Path currentProjectPom;
|
||||
|
@ -102,7 +109,7 @@ public class WorkspaceLoader implements WorkspaceModelResolver, WorkspaceReader
|
|||
|
||||
private void addModulePom(Path pom) {
|
||||
if (pom != null) {
|
||||
moduleQueue.add(new RawModule(pom));
|
||||
moduleQueue.push(new RawModule(pom));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,11 +159,22 @@ public class WorkspaceLoader implements WorkspaceModelResolver, WorkspaceReader
|
|||
};
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
while (i < moduleQueue.size()) {
|
||||
var newModules = new ArrayList<RawModule>();
|
||||
while (i < moduleQueue.size()) {
|
||||
loadModule(moduleQueue.get(i++), newModules);
|
||||
while (!moduleQueue.isEmpty()) {
|
||||
ConcurrentLinkedDeque<RawModule> newModules = new ConcurrentLinkedDeque<>();
|
||||
while (!moduleQueue.isEmpty()) {
|
||||
final Phaser phaser = new Phaser(1);
|
||||
while (!moduleQueue.isEmpty()) {
|
||||
phaser.register();
|
||||
final RawModule module = moduleQueue.removeLast();
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
loadModule(module, newModules);
|
||||
} finally {
|
||||
phaser.arriveAndDeregister();
|
||||
}
|
||||
});
|
||||
}
|
||||
phaser.arriveAndAwaitAdvance();
|
||||
}
|
||||
for (var newModule : newModules) {
|
||||
newModule.process(processor);
|
||||
|
@ -169,7 +187,7 @@ public class WorkspaceLoader implements WorkspaceModelResolver, WorkspaceReader
|
|||
return currentProject.get();
|
||||
}
|
||||
|
||||
private void loadModule(RawModule rawModule, List<RawModule> newModules) {
|
||||
private void loadModule(RawModule rawModule, Collection<RawModule> newModules) {
|
||||
var moduleDir = rawModule.pom.getParent();
|
||||
if (moduleDir == null) {
|
||||
moduleDir = getFsRootDir();
|
||||
|
@ -183,7 +201,7 @@ public class WorkspaceLoader implements WorkspaceModelResolver, WorkspaceReader
|
|||
rawModule.model = readModel(rawModule.pom);
|
||||
}
|
||||
loadedPoms.put(moduleDir, rawModule.model);
|
||||
if (rawModule.model == null) {
|
||||
if (rawModule.model == MISSING_MODEL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -212,9 +230,8 @@ public class WorkspaceLoader implements WorkspaceModelResolver, WorkspaceReader
|
|||
parentDir = getFsRootDir();
|
||||
}
|
||||
if (!loadedPoms.containsKey(parentDir)) {
|
||||
var parent = new RawModule(parentPom);
|
||||
rawModule.parent = parent;
|
||||
moduleQueue.add(parent);
|
||||
rawModule.parent = new RawModule(parentPom);
|
||||
moduleQueue.push(rawModule.parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +243,7 @@ public class WorkspaceLoader implements WorkspaceModelResolver, WorkspaceReader
|
|||
|
||||
private void queueModule(Path dir) {
|
||||
if (!loadedPoms.containsKey(dir)) {
|
||||
moduleQueue.add(new RawModule(dir.resolve(POM_XML)));
|
||||
moduleQueue.push(new RawModule(dir.resolve(POM_XML)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,7 +290,7 @@ public class WorkspaceLoader implements WorkspaceModelResolver, WorkspaceReader
|
|||
// which we don't support in this workspace loader
|
||||
log.warn("Module(s) under " + pom.getParent() + " will be handled as thirdparty dependencies because " + pom
|
||||
+ " does not exist");
|
||||
return null;
|
||||
return MISSING_MODEL;
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException("Failed to load POM from " + pom, e);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ quarkus.datasource.username=SYSTEM
|
|||
quarkus.datasource.password=hibernate_orm_test
|
||||
quarkus.datasource.jdbc.url=${oracledb.url}
|
||||
quarkus.datasource.jdbc.max-size=1
|
||||
quarkus.datasource.jdbc.transactions=xa
|
||||
quarkus.hibernate-orm.database.generation=drop-and-create
|
||||
quarkus.datasource.jdbc.additional-jdbc-properties."oracle.jdbc.timezoneAsRegion"=false
|
||||
|
||||
|
|
Loading…
Reference in New Issue