Created
August 19, 2024 16:01
-
-
Save liweinan/b54b069c9b9c2095fab6b38e9d1fdece to your computer and use it in GitHub Desktop.
Add log to WildFly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/deployment/JobOperatorService.java b/batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/deployment/JobOperatorService.java | |
index e22d1b5edee5..06229fbd18ac 100644 | |
--- a/batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/deployment/JobOperatorService.java | |
+++ b/batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/deployment/JobOperatorService.java | |
@@ -21,6 +21,7 @@ | |
import java.util.concurrent.atomic.AtomicBoolean; | |
import java.util.function.Consumer; | |
import java.util.function.Supplier; | |
+ | |
import jakarta.batch.operations.JobExecutionAlreadyCompleteException; | |
import jakarta.batch.operations.JobExecutionIsRunningException; | |
import jakarta.batch.operations.JobExecutionNotMostRecentException; | |
@@ -118,8 +119,13 @@ public void start(final StartContext context) throws StartException { | |
jobOperatorConsumer.accept(this); | |
} | |
+ String getCurrentMethodName() { | |
+ return Thread.currentThread().getStackTrace()[2].getMethodName(); | |
+ } | |
+ | |
@Override | |
public void stop(final StopContext context) { | |
+ BatchLogger.LOGGER.infof("EAPSUP-1550 %s -> context: %s", getCurrentMethodName(), context); | |
jobOperatorConsumer.accept(null); | |
// Remove the server activity | |
suspendControllerSupplier.get().unRegisterActivity(serverActivity); | |
@@ -262,11 +268,17 @@ public long restart(final long executionId, final Properties restartParameters) | |
@Override | |
public void stop(final long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException, JobSecurityException { | |
+ BatchLogger.LOGGER.infof("EAPSUP-1550 %s -> executionId: %s", getCurrentMethodName(), executionId); | |
+ | |
checkState(null, "stop"); | |
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); | |
try { | |
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); | |
+ | |
final JobInstance instance = super.getJobInstance(executionId); | |
+ | |
+ BatchLogger.LOGGER.infof("EAPSUP-1550 %s -> jobName: %s", getCurrentMethodName(), instance.getJobName()); | |
+ | |
validateJob(instance.getJobName()); | |
super.stop(executionId); | |
} finally { | |
@@ -456,6 +468,7 @@ public void propertyChange(PropertyChangeEvent evt) { | |
} | |
private void stopRunningJobs(final boolean queueForRestart) { | |
+ BatchLogger.LOGGER.infof("EAPSUP-1550 %s -> queueForRestart: %s", getCurrentMethodName(), queueForRestart); | |
if (jobsStopped.compareAndSet(false, true)) { | |
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); | |
permissionsCheckEnabled.set(Boolean.FALSE); | |
@@ -467,8 +480,11 @@ private void stopRunningJobs(final boolean queueForRestart) { | |
// jobRepository.getJobNames() to get all active job names, which will | |
// be filtered in the loop below for valid job names for the current deployment. | |
final Collection<String> jobNames = getJobRepository().getJobNames(); | |
+ | |
+ | |
// Look for running jobs and attempt to stop each one | |
for (String jobName : jobNames) { | |
+ BatchLogger.LOGGER.infof("EAPSUP-1550 %s -> jobName: %s", getCurrentMethodName(), jobName); | |
if (resolver.isValidJobName(jobName)) { | |
// Casting to (Supplier<List<Long>>) is done here on purpose as a workaround for a bug in 1.8.0_45 | |
final List<Long> runningJobs = allowMissingJob((Supplier<List<Long>>) () -> getRunningExecutions(jobName), Collections.emptyList()); | |
@@ -483,6 +499,7 @@ private void stopRunningJobs(final boolean queueForRestart) { | |
stoppedIds.add(id); | |
} | |
} catch (Exception e) { | |
+ BatchLogger.LOGGER.infof("EAPSUP-1550 %s -> e: ", getCurrentMethodName(), e); | |
BatchLogger.LOGGER.stoppingJobFailed(e, id, jobName, deploymentName); | |
} | |
} | |
diff --git a/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jberet/jberet-core/main/module.xml b/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jberet/jberet-core/main/module.xml | |
index 056665f17de4..39c296073a04 100644 | |
--- a/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jberet/jberet-core/main/module.xml | |
+++ b/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jberet/jberet-core/main/module.xml | |
@@ -29,7 +29,6 @@ | |
<module name="org.jboss.marshalling"/> | |
<module name="org.jboss.logging"/> | |
<module name="org.wildfly.security.elytron-private"/> | |
- <module name="com.google.guava"/> | |
<module name="com.h2database.h2" optional="true"/> | |
<module name="java.xml"/> | |
</dependencies> | |
diff --git a/pom.xml b/pom.xml | |
index 06295156eaa4..bda7d6c89c7c 100644 | |
--- a/pom.xml | |
+++ b/pom.xml | |
@@ -523,7 +523,7 @@ | |
<version.org.infinispan>14.0.30.Final</version.org.infinispan> | |
<version.org.infinispan.protostream>4.6.5.Final</version.org.infinispan.protostream> | |
<version.org.jasypt>1.9.3</version.org.jasypt> | |
- <version.org.jberet>2.2.1.Final</version.org.jberet> | |
+ <version.org.jberet>3.0.0.Final</version.org.jberet> | |
<version.org.jboss.activemq.artemis.integration>2.0.2.Final</version.org.jboss.activemq.artemis.integration> | |
<version.org.jboss.common.jboss-common-beans>2.0.1.Final</version.org.jboss.common.jboss-common-beans> | |
<version.org.jboss.ejb-client>5.0.6.Final</version.org.jboss.ejb-client> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment