IDEMPIERE-4332 PO Serialization Optimization (#114)

Do not serialize context and POInfo
This commit is contained in:
hengsin 2020-06-13 21:21:31 +08:00 committed by GitHub
parent fb67a8f375
commit 5adad12309
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -232,9 +232,9 @@ public abstract class PO
private static CLogger s_log = CLogger.getCLogger (PO.class); private static CLogger s_log = CLogger.getCLogger (PO.class);
/** Context */ /** Context */
protected Properties p_ctx; protected transient Properties p_ctx;
/** Model Info */ /** Model Info */
protected volatile POInfo p_info = null; protected transient volatile POInfo p_info = null;
/** Original Values */ /** Original Values */
private Object[] m_oldValues = null; private Object[] m_oldValues = null;
@ -4820,6 +4820,8 @@ public abstract class PO
// default deserialization // default deserialization
ois.defaultReadObject(); ois.defaultReadObject();
log = CLogger.getCLogger(getClass()); log = CLogger.getCLogger(getClass());
p_ctx = Env.getCtx();
p_info = initPO(p_ctx);
} }
public void set_Attribute(String columnName, Object value) { public void set_Attribute(String columnName, Object value) {

View File

@ -16,6 +16,8 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -86,7 +88,7 @@ public class POInfo implements Serializable
} // getPOInfo } // getPOInfo
/** Cache of POInfo */ /** Cache of POInfo */
private static CCache<Integer,POInfo> s_cache = new CCache<Integer,POInfo>(I_AD_Table.Table_Name, "POInfo", 200); private static CCache<Integer,POInfo> s_cache = new CCache<Integer,POInfo>(I_AD_Table.Table_Name, "POInfo", 200, 0, false, 0);
/************************************************************************** /**************************************************************************
* Create Persistent Info * Create Persistent Info
@ -115,7 +117,7 @@ public class POInfo implements Serializable
} // PInfo } // PInfo
/** Context */ /** Context */
private Properties m_ctx = null; private transient Properties m_ctx = null;
/** Table_ID */ /** Table_ID */
private int m_AD_Table_ID = 0; private int m_AD_Table_ID = 0;
/** Table Name */ /** Table Name */
@ -835,4 +837,10 @@ public class POInfo implements Serializable
return m_IsChangeLog; return m_IsChangeLog;
} }
private void readObject(ObjectInputStream ois)
throws ClassNotFoundException, IOException {
// default deserialization
ois.defaultReadObject();
m_ctx = Env.getCtx();
}
} // POInfo } // POInfo