Skip to content

Commit

Permalink
Simplify undeploy logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Sep 2, 2024
1 parent 7218c3e commit d3d2a39
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 1 addition & 3 deletions jpos/src/main/java/org/jpos/log/evt/UnDeploy.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

package org.jpos.log.evt;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import org.jpos.log.AuditLogEvent;

public record UnDeploy(String path, @JacksonXmlProperty(isAttribute = true) boolean start) implements AuditLogEvent { }

public record UnDeploy(String path) implements AuditLogEvent { }
18 changes: 9 additions & 9 deletions jpos/src/main/java/org/jpos/q2/Q2.java
Original file line number Diff line number Diff line change
Expand Up @@ -527,20 +527,22 @@ private long persist (File f, ObjectName name) {

private void undeploy (File f) {
QEntry qentry = dirMap.get (f);
LogEvent evt = log != null ? log.createInfo().withTraceId(getInstanceId()) : null;
try {
if (log != null)
log.info (new UnDeploy(f.getCanonicalPath(), true));
if (evt != null)
evt.addMessage (new UnDeploy(f.getCanonicalPath()));

if (qentry.isQBean()) {
Object obj = qentry.getObject ();
ObjectName name = qentry.getObjectName ();
factory.destroyQBean (this, name, obj);
}
if (log != null)
log.info (new UnDeploy(f.getCanonicalPath(), false));

} catch (Exception e) {
getLog().warn ("undeploy", e);
if (evt != null)
evt.addMessage (e);
} finally {
if (evt != null)
Logger.log(evt);
}
}

Expand All @@ -561,10 +563,8 @@ private boolean register (File f) {

private boolean deploy (File f) {
LogEvent evt = log != null ? log.createInfo().withTraceId(getInstanceId()) : null;
boolean enabled = false;
String filePath = "";
boolean enabled;
try {
filePath = f.getCanonicalPath();
QEntry qentry = dirMap.get (f);
SAXBuilder builder = createSAXBuilder();
Document doc;
Expand Down

0 comments on commit d3d2a39

Please sign in to comment.