IDEMPIERE-5045 Applying packins is leaving open records in AD_Session (Processed=N) (#986)
This commit is contained in:
parent
5ccd54caf8
commit
951f32a3dc
|
@ -95,8 +95,13 @@ public class AdempiereActivator extends AbstractActivator {
|
|||
protected void packIn() {
|
||||
URL packout = context.getBundle().getEntry("/META-INF/2Pack.zip");
|
||||
if (packout != null && service != null) {
|
||||
MSession localSession = null;
|
||||
//Create Session to be able to create records in AD_ChangeLog
|
||||
MSession.get(Env.getCtx(), true);
|
||||
if (Env.getContextAsInt(Env.getCtx(), Env.AD_SESSION_ID) <= 0) {
|
||||
localSession = MSession.get(Env.getCtx(), true);
|
||||
localSession.setWebSession("AdempiereActivator");
|
||||
localSession.saveEx();
|
||||
}
|
||||
FileOutputStream zipstream = null;
|
||||
try {
|
||||
// copy the resource to a temporary file to process it with 2pack
|
||||
|
@ -119,6 +124,8 @@ public class AdempiereActivator extends AbstractActivator {
|
|||
zipstream.close();
|
||||
} catch (Exception e2) {}
|
||||
}
|
||||
if (localSession != null)
|
||||
localSession.logout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,8 +209,13 @@ public class Incremental2PackActivator extends AbstractActivator {
|
|||
|
||||
protected boolean packIn(URL packout) {
|
||||
if (packout != null && service != null) {
|
||||
MSession localSession = null;
|
||||
//Create Session to be able to create records in AD_ChangeLog
|
||||
MSession.get(Env.getCtx(), true);
|
||||
if (Env.getContextAsInt(Env.getCtx(), Env.AD_SESSION_ID) <= 0) {
|
||||
localSession = MSession.get(Env.getCtx(), true);
|
||||
localSession.setWebSession("Incremental2PackActivator");
|
||||
localSession.saveEx();
|
||||
}
|
||||
String path = packout.getPath();
|
||||
String suffix = "_"+path.substring(path.lastIndexOf("2Pack_"));
|
||||
logger.log(Level.WARNING, "Installing " + getName() + " " + path + " ...");
|
||||
|
@ -237,6 +242,8 @@ public class Incremental2PackActivator extends AbstractActivator {
|
|||
zipstream.close();
|
||||
} catch (Exception e2) {}
|
||||
}
|
||||
if (localSession != null)
|
||||
localSession.logout();
|
||||
}
|
||||
logger.log(Level.WARNING, getName() + " " + packout.getPath() + " installed");
|
||||
}
|
||||
|
|
|
@ -96,11 +96,15 @@ public class PackInApplicationActivator extends AbstractActivator{
|
|||
return;
|
||||
}
|
||||
|
||||
MSession localSession = null;
|
||||
try {
|
||||
if (getDBLock()) {
|
||||
//Create Session to be able to create records in AD_ChangeLog
|
||||
if (Env.getContextAsInt(Env.getCtx(), Env.AD_SESSION_ID) <= 0)
|
||||
MSession.get(Env.getCtx(), true);
|
||||
if (Env.getContextAsInt(Env.getCtx(), Env.AD_SESSION_ID) <= 0) {
|
||||
localSession = MSession.get(Env.getCtx(), true);
|
||||
localSession.setWebSession("PackInApplicationActivator");
|
||||
localSession.saveEx();
|
||||
}
|
||||
for(File zipFile : fileArray) {
|
||||
currentFile = zipFile;
|
||||
if (!packIn(zipFile)) {
|
||||
|
@ -125,6 +129,8 @@ public class PackInApplicationActivator extends AbstractActivator{
|
|||
addLog(Level.WARNING, e.getLocalizedMessage());
|
||||
} finally {
|
||||
releaseLock();
|
||||
if (localSession != null)
|
||||
localSession.logout();
|
||||
}
|
||||
|
||||
if (filesToProcess.size() > 0) {
|
||||
|
|
|
@ -146,10 +146,15 @@ public class Version2PackActivator extends AbstractActivator{
|
|||
}
|
||||
});
|
||||
|
||||
MSession localSession = null;
|
||||
try {
|
||||
if (getDBLock()) {
|
||||
//Create Session to be able to create records in AD_ChangeLog
|
||||
MSession.get(Env.getCtx(), true);
|
||||
if (Env.getContextAsInt(Env.getCtx(), Env.AD_SESSION_ID) <= 0) {
|
||||
localSession = MSession.get(Env.getCtx(), true);
|
||||
localSession.setWebSession("Version2PackActivator");
|
||||
localSession.saveEx();
|
||||
}
|
||||
for(TwoPackEntry entry : list) {
|
||||
if (!packIn(entry.url)) {
|
||||
// stop processing further packages if one fail
|
||||
|
@ -163,6 +168,8 @@ public class Version2PackActivator extends AbstractActivator{
|
|||
e.printStackTrace();
|
||||
} finally {
|
||||
releaseLock();
|
||||
if (localSession != null)
|
||||
localSession.logout();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue