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