Skip to content

Commit

Permalink
update objectstore directory
Browse files Browse the repository at this point in the history
  • Loading branch information
zhfeng committed Sep 19, 2022
1 parent 73936ba commit ca64491
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import io.quarkus.deployment.builditem.nativeimage.NativeImageSystemPropertyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem;
import io.quarkus.gizmo.ClassCreator;
import io.quarkus.narayana.jta.runtime.CDIDelegatingTransactionManager;
import io.quarkus.narayana.jta.runtime.NarayanaJtaProducers;
Expand Down Expand Up @@ -80,7 +81,8 @@ public void build(NarayanaJtaRecorder recorder,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
BuildProducer<RuntimeInitializedClassBuildItem> runtimeInit,
BuildProducer<FeatureBuildItem> feature,
TransactionManagerConfiguration transactions, ShutdownContextBuildItem shutdownContextBuildItem) {
TransactionManagerConfiguration transactions, OutputTargetBuildItem target,
ShutdownContextBuildItem shutdownContextBuildItem) {
recorder.handleShutdown(shutdownContextBuildItem, transactions);
feature.produce(new FeatureBuildItem(Feature.NARAYANA_JTA));
additionalBeans.produce(new AdditionalBeanBuildItem(NarayanaJtaProducers.class));
Expand Down Expand Up @@ -133,7 +135,7 @@ public void build(NarayanaJtaRecorder recorder,
recorder.disableTransactionStatusManager();
recorder.setNodeName(transactions);
recorder.setDefaultTimeout(transactions);
recorder.setConfig(transactions);
recorder.setConfig(transactions, target.getOutputDirectory().toAbsolutePath().toString());
}

@BuildStep(onlyIf = IsTest.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.quarkus.narayana.jta.runtime;

import java.io.File;
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.Properties;
Expand Down Expand Up @@ -71,13 +72,14 @@ public void disableTransactionStatusManager() {
.setTransactionStatusManagerEnable(false);
}

public void setConfig(final TransactionManagerConfiguration transactions) {
public void setConfig(final TransactionManagerConfiguration transactions, final String outputTarget) {
String objectStoreDir = transactions.objectStoreDirectory.orElse(outputTarget + File.separator + "ObjectStore");
BeanPopulator.getDefaultInstance(ObjectStoreEnvironmentBean.class)
.setObjectStoreDir(transactions.objectStoreDirectory);
.setObjectStoreDir(objectStoreDir);
BeanPopulator.getNamedInstance(ObjectStoreEnvironmentBean.class, "communicationStore")
.setObjectStoreDir(transactions.objectStoreDirectory);
.setObjectStoreDir(objectStoreDir);
BeanPopulator.getNamedInstance(ObjectStoreEnvironmentBean.class, "stateStore")
.setObjectStoreDir(transactions.objectStoreDirectory);
.setObjectStoreDir(objectStoreDir);
BeanPopulator.getDefaultInstance(RecoveryEnvironmentBean.class)
.setRecoveryModuleClassNames(transactions.recoveryModules);
BeanPopulator.getDefaultInstance(RecoveryEnvironmentBean.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.time.Duration;
import java.util.List;
import java.util.Optional;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
Expand Down Expand Up @@ -29,8 +30,8 @@ public final class TransactionManagerConfiguration {
* If the value is not absolute then the directory is relative
* to the <em>user.dir</em> system property.
*/
@ConfigItem(defaultValue = "ObjectStore")
public String objectStoreDirectory;
@ConfigItem
public Optional<String> objectStoreDirectory;

/**
* Enable recovery service to start on startup
Expand Down

0 comments on commit ca64491

Please sign in to comment.