IDEMPIERE-491 Caching data can generate problem. Refactor the caching code, added distributed cache and cluster wide cache reset support.
This commit is contained in:
parent
fb883fd47c
commit
c8b4a158b7
|
@ -16,6 +16,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.process;
|
package org.compiere.process;
|
||||||
|
|
||||||
|
import org.compiere.util.CacheMgt;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,6 +44,7 @@ public class CacheReset extends SvrProcess implements ClientProcess
|
||||||
{
|
{
|
||||||
log.info("");
|
log.info("");
|
||||||
Env.reset(false); // not final
|
Env.reset(false); // not final
|
||||||
|
CacheMgt.get().reset();
|
||||||
return "Cache Reset";
|
return "Cache Reset";
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.MUser;
|
import org.compiere.model.MUser;
|
||||||
import org.compiere.model.SystemIDs;
|
import org.compiere.model.SystemIDs;
|
||||||
|
import org.compiere.util.CacheMgt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hash existing passwords
|
* Hash existing passwords
|
||||||
|
@ -54,7 +55,7 @@ public class HashPasswords extends SvrProcess
|
||||||
MSysConfig conf = new MSysConfig(getCtx(), SystemIDs.SYSCONFIG_USER_HASH_PASSWORD, null);
|
MSysConfig conf = new MSysConfig(getCtx(), SystemIDs.SYSCONFIG_USER_HASH_PASSWORD, null);
|
||||||
conf.setValue("Y");
|
conf.setValue("Y");
|
||||||
conf.saveEx();
|
conf.saveEx();
|
||||||
MSysConfig.resetCache();
|
CacheMgt.get().reset(MSysConfig.Table_Name);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -184,6 +184,7 @@ Export-Package: bsh,
|
||||||
org.compiere.util,
|
org.compiere.util,
|
||||||
org.compiere.wf,
|
org.compiere.wf,
|
||||||
org.eevolution.model,
|
org.eevolution.model,
|
||||||
|
org.idempiere.distributed,
|
||||||
org.jfree,
|
org.jfree,
|
||||||
org.jfree.base,
|
org.jfree.base,
|
||||||
org.jfree.base.config,
|
org.jfree.base.config,
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.compiere.util.Util;
|
||||||
*/
|
*/
|
||||||
public class DefaultModelFactory implements IModelFactory {
|
public class DefaultModelFactory implements IModelFactory {
|
||||||
|
|
||||||
private static CCache<String,Class<?>> s_classCache = new CCache<String,Class<?>>("PO_Class", 20);
|
private static CCache<String,Class<?>> s_classCache = new CCache<String,Class<?>>(null, "PO_Class", 20, false);
|
||||||
private final static CLogger s_log = CLogger.getCLogger(DefaultModelFactory.class);
|
private final static CLogger s_log = CLogger.getCLogger(DefaultModelFactory.class);
|
||||||
|
|
||||||
/** Packages for Model Classes */
|
/** Packages for Model Classes */
|
||||||
|
|
|
@ -686,7 +686,7 @@ public final class Adempiere
|
||||||
m_listenerList.add(ServerStateChangeListener.class, l);
|
m_listenerList.add(ServerStateChangeListener.class, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fireServerStateChanged(ServerStateChangeEvent e)
|
private static synchronized void fireServerStateChanged(ServerStateChangeEvent e)
|
||||||
{
|
{
|
||||||
ServerStateChangeListener[] listeners = m_listenerList.getListeners(ServerStateChangeListener.class);
|
ServerStateChangeListener[] listeners = m_listenerList.getListeners(ServerStateChangeListener.class);
|
||||||
for (int i = 0; i < listeners.length; i++)
|
for (int i = 0; i < listeners.length; i++)
|
||||||
|
|
|
@ -136,9 +136,9 @@ public class MAcctSchema extends X_C_AcctSchema
|
||||||
} // getClientAcctSchema
|
} // getClientAcctSchema
|
||||||
|
|
||||||
/** Cache of Client AcctSchema Arrays **/
|
/** Cache of Client AcctSchema Arrays **/
|
||||||
private static CCache<Integer,MAcctSchema[]> s_schema = new CCache<Integer,MAcctSchema[]>("AD_ClientInfo", 3); // 3 clients
|
private static CCache<Integer,MAcctSchema[]> s_schema = new CCache<Integer,MAcctSchema[]>(I_AD_ClientInfo.Table_Name, 3); // 3 clients
|
||||||
/** Cache of AcctSchemas **/
|
/** Cache of AcctSchemas **/
|
||||||
private static CCache<Integer,MAcctSchema> s_cache = new CCache<Integer,MAcctSchema>("C_AcctSchema", 3); // 3 accounting schemas
|
private static CCache<Integer,MAcctSchema> s_cache = new CCache<Integer,MAcctSchema>(Table_Name, 3); // 3 accounting schemas
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -172,7 +172,7 @@ public final class MAcctSchemaElement extends X_C_AcctSchema_Element
|
||||||
private static CLogger s_log = CLogger.getCLogger (MAcctSchemaElement.class);
|
private static CLogger s_log = CLogger.getCLogger (MAcctSchemaElement.class);
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MAcctSchemaElement[]> s_cache = new CCache<Integer,MAcctSchemaElement[]>("C_AcctSchema_Element", 10);
|
private static CCache<Integer,MAcctSchemaElement[]> s_cache = new CCache<Integer,MAcctSchemaElement[]>(Table_Name, 10);
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class MAlertProcessor extends X_AD_AlertProcessor
|
||||||
} // MAlertProcessor
|
} // MAlertProcessor
|
||||||
|
|
||||||
/** Cache: AD_AlertProcessor -> Alerts array */
|
/** Cache: AD_AlertProcessor -> Alerts array */
|
||||||
private static CCache<Integer, MAlert[]> s_cacheAlerts = new CCache<Integer, MAlert[]>("AD_Alert_ForProcessor", 10);
|
private static CCache<Integer, MAlert[]> s_cacheAlerts = new CCache<Integer, MAlert[]>(I_AD_Alert.Table_Name, "AD_Alert_ForProcessor", 10, false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Server ID
|
* Get Server ID
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class MAssetAcct extends X_A_Asset_Acct
|
||||||
/** Static Cache: A_Asset_Acct_ID -> MAssetAcct */
|
/** Static Cache: A_Asset_Acct_ID -> MAssetAcct */
|
||||||
private static CCache<Integer,MAssetAcct> s_cache = new CCache<Integer,MAssetAcct>(Table_Name, 5);
|
private static CCache<Integer,MAssetAcct> s_cache = new CCache<Integer,MAssetAcct>(Table_Name, 5);
|
||||||
/** Static Cache: Asset,PostingType,DateAcct -> MAssetAcct */
|
/** Static Cache: Asset,PostingType,DateAcct -> MAssetAcct */
|
||||||
private static CCache<MultiKey,MAssetAcct> s_cacheAsset = new CCache<MultiKey,MAssetAcct>(Table_Name+"_Asset", 5);
|
private static CCache<MultiKey,MAssetAcct> s_cacheAsset = new CCache<MultiKey,MAssetAcct>(Table_Name, Table_Name+"_Asset", 5, false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Asset Accounting (from cache)
|
* Get Asset Accounting (from cache)
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class MAssetClass extends X_A_Asset_Class
|
||||||
} // MAssetClass
|
} // MAssetClass
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
private static CCache<Integer, MAssetClass> s_cache = new CCache<Integer, MAssetClass>("A_Asset_Class", 20);
|
private static CCache<Integer, MAssetClass> s_cache = new CCache<Integer, MAssetClass>(Table_Name, 20);
|
||||||
|
|
||||||
/** Get Asset Class from cache
|
/** Get Asset Class from cache
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class MAttributeSet extends X_M_AttributeSet
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MAttributeSet> s_cache
|
private static CCache<Integer,MAttributeSet> s_cache
|
||||||
= new CCache<Integer,MAttributeSet> ("M_AttributeSet", 20);
|
= new CCache<Integer,MAttributeSet> (Table_Name, 20);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class MBOM extends X_M_BOM
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MBOM> s_cache
|
private static CCache<Integer,MBOM> s_cache
|
||||||
= new CCache<Integer,MBOM>("M_BOM", 20);
|
= new CCache<Integer,MBOM>(Table_Name, 20);
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MBOM.class);
|
private static CLogger s_log = CLogger.getCLogger (MBOM.class);
|
||||||
|
|
||||||
|
|
|
@ -158,10 +158,10 @@ public class MBPGroup extends X_C_BP_Group
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MBPGroup> s_cache
|
private static CCache<Integer,MBPGroup> s_cache
|
||||||
= new CCache<Integer,MBPGroup>("BP_Group", 10);
|
= new CCache<Integer,MBPGroup>(Table_Name, 10);
|
||||||
/** Default Cache */
|
/** Default Cache */
|
||||||
private static CCache<Integer,MBPGroup> s_cacheDefault
|
private static CCache<Integer,MBPGroup> s_cacheDefault
|
||||||
= new CCache<Integer,MBPGroup>("BP_Group", 5);
|
= new CCache<Integer,MBPGroup>(Table_Name, MBPGroup.class.getName()+".Default", 5);
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MBPGroup.class);
|
private static CLogger s_log = CLogger.getCLogger (MBPGroup.class);
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class MCalendar extends X_C_Calendar
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MCalendar> s_cache
|
private static CCache<Integer,MCalendar> s_cache
|
||||||
= new CCache<Integer,MCalendar>("C_Calendar", 20);
|
= new CCache<Integer,MCalendar>(Table_Name, 20);
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class MCashBook extends X_C_CashBook
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MCashBook> s_cache
|
private static CCache<Integer,MCashBook> s_cache
|
||||||
= new CCache<Integer,MCashBook>("", 20);
|
= new CCache<Integer,MCashBook>(Table_Name, 20);
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MCashBook.class);
|
private static CLogger s_log = CLogger.getCLogger (MCashBook.class);
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class MCharge extends X_C_Charge
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer, MCharge> s_cache
|
private static CCache<Integer, MCharge> s_cache
|
||||||
= new CCache<Integer, MCharge> ("C_Charge", 10);
|
= new CCache<Integer, MCharge> (Table_Name, 10);
|
||||||
|
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MCharge.class);
|
private static CLogger s_log = CLogger.getCLogger (MCharge.class);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class MChatType extends X_CM_ChatType
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer, MChatType> s_cache
|
private static CCache<Integer, MChatType> s_cache
|
||||||
= new CCache<Integer, MChatType> ("CM_ChatType", 20);
|
= new CCache<Integer, MChatType> (Table_Name, 20);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
@ -59,7 +59,7 @@ public final class MCity extends X_C_City
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** City Cache */
|
/** City Cache */
|
||||||
private static CCache<Integer,MCity> s_Cities = new CCache<Integer,MCity>("C_City", 20);;
|
private static CCache<Integer,MCity> s_Cities = new CCache<Integer,MCity>(Table_Name, 20);;
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MCity.class);
|
private static CLogger s_log = CLogger.getCLogger (MCity.class);
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class MClient extends X_AD_Client
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private static CLogger s_log = CLogger.getCLogger (MClient.class);
|
private static CLogger s_log = CLogger.getCLogger (MClient.class);
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MClient> s_cache = new CCache<Integer,MClient>("AD_Client", 3);
|
private static CCache<Integer,MClient> s_cache = new CCache<Integer,MClient>(Table_Name, 3);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -633,7 +633,8 @@ public class MClient extends X_AD_Client
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
log.severe(getName() + " - " + ex.getLocalizedMessage());
|
ex.printStackTrace();
|
||||||
|
log.log(Level.SEVERE, getName() + " - " + ex.getLocalizedMessage(), ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} // sendEMail
|
} // sendEMail
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class MClientInfo extends X_AD_ClientInfo
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MClientInfo> s_cache = new CCache<Integer,MClientInfo>("AD_ClientInfo", 2);
|
private static CCache<Integer,MClientInfo> s_cache = new CCache<Integer,MClientInfo>(Table_Name, 2);
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MClientInfo.class);
|
private static CLogger s_log = CLogger.getCLogger (MClientInfo.class);
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class MClientShare extends X_AD_ClientShare
|
||||||
|
|
||||||
/** Shared Info */
|
/** Shared Info */
|
||||||
private static CCache<String,Boolean> s_shares
|
private static CCache<String,Boolean> s_shares
|
||||||
= new CCache<String,Boolean>("AD_ClientShare", 10, 120); // 2h
|
= new CCache<String,Boolean>(Table_Name, 10, 120); // 2h
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MClientShare.class);
|
private static CLogger s_log = CLogger.getCLogger (MClientShare.class);
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class MColorSchema extends X_PA_ColorSchema
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer, MColorSchema> s_cache
|
private static CCache<Integer, MColorSchema> s_cache
|
||||||
= new CCache<Integer, MColorSchema> ("PA_ColorSchema", 20);
|
= new CCache<Integer, MColorSchema> (Table_Name, 20);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class MColumn extends X_AD_Column
|
||||||
} // getColumnName
|
} // getColumnName
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MColumn> s_cache = new CCache<Integer,MColumn>("AD_Column", 20);
|
private static CCache<Integer,MColumn> s_cache = new CCache<Integer,MColumn>(Table_Name, 20);
|
||||||
|
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MColumn.class);
|
private static CLogger s_log = CLogger.getCLogger (MColumn.class);
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class MConversionType extends X_C_ConversionType
|
||||||
} // getDefault
|
} // getDefault
|
||||||
|
|
||||||
/** Cache Client-ID */
|
/** Cache Client-ID */
|
||||||
private static CCache<Integer,Integer> s_cache = new CCache<Integer,Integer>("C_ConversionType", 4);
|
private static CCache<Integer,Integer> s_cache = new CCache<Integer,Integer>(Table_Name, 4);
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
@ -210,7 +210,7 @@ public class MCostElement extends X_M_CostElement
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MCostElement> s_cache = new CCache<Integer,MCostElement>("M_CostElement", 20);
|
private static CCache<Integer,MCostElement> s_cache = new CCache<Integer,MCostElement>(Table_Name, 20);
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MCostElement.class);
|
private static CLogger s_log = CLogger.getCLogger (MCostElement.class);
|
||||||
|
|
|
@ -112,7 +112,7 @@ public final class MCountry extends X_C_Country
|
||||||
MLanguage lang = MLanguage.get(ctx, client.getAD_Language());
|
MLanguage lang = MLanguage.get(ctx, client.getAD_Language());
|
||||||
MCountry usa = null;
|
MCountry usa = null;
|
||||||
//
|
//
|
||||||
s_countries = new CCache<String,MCountry>("C_Country", 250);
|
s_countries = new CCache<String,MCountry>(Table_Name, 250);
|
||||||
String sql = "SELECT * FROM C_Country WHERE IsActive='Y'";
|
String sql = "SELECT * FROM C_Country WHERE IsActive='Y'";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,9 +87,9 @@ public class MCurrency extends X_C_Currency
|
||||||
|
|
||||||
|
|
||||||
/** Store System Currencies **/
|
/** Store System Currencies **/
|
||||||
private static CCache<Integer,MCurrency> s_currencies = new CCache<Integer,MCurrency>("C_Currency", 50);
|
private static CCache<Integer,MCurrency> s_currencies = new CCache<Integer,MCurrency>(Table_Name, 50);
|
||||||
/** Cache System Currencies by using ISO code as key **/
|
/** Cache System Currencies by using ISO code as key **/
|
||||||
private static CCache<String,MCurrency> s_currenciesISO = new CCache<String,MCurrency>("C_CurrencyISO", 50);
|
private static CCache<String,MCurrency> s_currenciesISO = new CCache<String,MCurrency>(Table_Name, "C_CurrencyISO", 50);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Currency using ISO code
|
* Get Currency using ISO code
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class MDepreciation extends X_A_Depreciation
|
||||||
s_cache = new CCache<Integer,MDepreciation>(Table_Name, 5);
|
s_cache = new CCache<Integer,MDepreciation>(Table_Name, 5);
|
||||||
/** Cache for type */
|
/** Cache for type */
|
||||||
private static CCache<String,MDepreciation>
|
private static CCache<String,MDepreciation>
|
||||||
s_cache_forType = new CCache<String,MDepreciation>(Table_Name+"_DepreciationType", 5);
|
s_cache_forType = new CCache<String,MDepreciation>(Table_Name, Table_Name+"_DepreciationType", 5);
|
||||||
/** Static logger */
|
/** Static logger */
|
||||||
private static Logger s_log = CLogger.getCLogger(MDepreciation.class);
|
private static Logger s_log = CLogger.getCLogger(MDepreciation.class);
|
||||||
/** The accuracy of calculation on depreciation */
|
/** The accuracy of calculation on depreciation */
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class MDepreciationConvention extends X_A_Depreciation_Convention
|
||||||
} // MDepreciationConvention
|
} // MDepreciationConvention
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MDepreciationConvention> s_cache = new CCache<Integer,MDepreciationConvention>("A_Depreciation_Convention", 5);
|
private static CCache<Integer,MDepreciationConvention> s_cache = new CCache<Integer,MDepreciationConvention>(Table_Name, 5);
|
||||||
//~ /** Static logger */
|
//~ /** Static logger */
|
||||||
//~ private static Logger s_log = CLogger.getCLogger(MDepreciationConvention.class);
|
//~ private static Logger s_log = CLogger.getCLogger(MDepreciationConvention.class);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class MDepreciationMethod extends X_A_Depreciation_Method
|
||||||
s_cache = new CCache<Integer,MDepreciationMethod>(Table_Name, 5);
|
s_cache = new CCache<Integer,MDepreciationMethod>(Table_Name, 5);
|
||||||
/** Cache for type */
|
/** Cache for type */
|
||||||
private static CCache<String,MDepreciationMethod>
|
private static CCache<String,MDepreciationMethod>
|
||||||
s_cache_forType = new CCache<String,MDepreciationMethod>(Table_Name+"_DepreciationType", 5);
|
s_cache_forType = new CCache<String,MDepreciationMethod>(Table_Name, Table_Name+"_DepreciationType", 5);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -336,7 +336,7 @@ public class MDepreciationWorkfile extends X_A_Depreciation_Workfile
|
||||||
}
|
}
|
||||||
/** Static cache: Asset/PostingType -> Workfile */
|
/** Static cache: Asset/PostingType -> Workfile */
|
||||||
private static CCache<MultiKey, MDepreciationWorkfile>
|
private static CCache<MultiKey, MDepreciationWorkfile>
|
||||||
s_cacheAsset = new CCache<MultiKey, MDepreciationWorkfile>(Table_Name+"_Asset", 10);
|
s_cacheAsset = new CCache<MultiKey, MDepreciationWorkfile>(Table_Name, Table_Name+"_Asset", 10);
|
||||||
|
|
||||||
/** Returns the date of the last action
|
/** Returns the date of the last action
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class MDiscountSchema extends X_M_DiscountSchema
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MDiscountSchema> s_cache
|
private static CCache<Integer,MDiscountSchema> s_cache
|
||||||
= new CCache<Integer,MDiscountSchema>("M_DiscountSchema", 20);
|
= new CCache<Integer,MDiscountSchema>(Table_Name, 20);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class MDistribution extends X_GL_Distribution
|
||||||
private static CLogger s_log = CLogger.getCLogger (MDistribution.class);
|
private static CLogger s_log = CLogger.getCLogger (MDistribution.class);
|
||||||
/** Distributions by Account */
|
/** Distributions by Account */
|
||||||
private static CCache<Integer,MDistribution[]> s_accounts
|
private static CCache<Integer,MDistribution[]> s_accounts
|
||||||
= new CCache<Integer,MDistribution[]>("GL_Distribution", 100);
|
= new CCache<Integer,MDistribution[]>(Table_Name, 100);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -200,9 +200,9 @@ public class MDocTypeCounter extends X_C_DocTypeCounter
|
||||||
|
|
||||||
|
|
||||||
/** Object Cache */
|
/** Object Cache */
|
||||||
private static CCache<Integer,MDocTypeCounter> s_cache = new CCache<Integer,MDocTypeCounter>("C_DocTypeCounter", 20);
|
private static CCache<Integer,MDocTypeCounter> s_cache = new CCache<Integer,MDocTypeCounter>(Table_Name, 20);
|
||||||
/** Counter Relationship Cache */
|
/** Counter Relationship Cache */
|
||||||
private static CCache<Integer,MDocTypeCounter> s_counter = new CCache<Integer,MDocTypeCounter>("C_DocTypeCounter", 20);
|
private static CCache<Integer,MDocTypeCounter> s_counter = new CCache<Integer,MDocTypeCounter>(Table_Name, "C_DocTypeCounter_Relation", 20);
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MDocTypeCounter.class);
|
private static CLogger s_log = CLogger.getCLogger (MDocTypeCounter.class);
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class MGLCategory extends X_GL_Category
|
||||||
private static CLogger s_log = CLogger.getCLogger (MGLCategory.class);
|
private static CLogger s_log = CLogger.getCLogger (MGLCategory.class);
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer, MGLCategory> s_cache
|
private static CCache<Integer, MGLCategory> s_cache
|
||||||
= new CCache<Integer, MGLCategory> ("GL_Category", 5);
|
= new CCache<Integer, MGLCategory> (Table_Name, 5);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class MGroup extends X_R_Group
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MGroup> s_cache = new CCache<Integer,MGroup>("R_Group", 20);
|
private static CCache<Integer,MGroup> s_cache = new CCache<Integer,MGroup>(Table_Name, 20);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class MHierarchy extends X_PA_Hierarchy
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer, MHierarchy> s_cache
|
private static CCache<Integer, MHierarchy> s_cache
|
||||||
= new CCache<Integer, MHierarchy> ("PA_Hierarchy_ID", 20);
|
= new CCache<Integer, MHierarchy> (Table_Name, 20);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class MImage extends X_AD_Image
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MImage> s_cache = new CCache<Integer,MImage>("AD_Image", 20);
|
private static CCache<Integer,MImage> s_cache = new CCache<Integer,MImage>(Table_Name, 20);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class MInterestArea extends X_R_InterestArea
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MInterestArea> s_cache =
|
private static CCache<Integer,MInterestArea> s_cache =
|
||||||
new CCache<Integer,MInterestArea>("R_InterestArea", 5);
|
new CCache<Integer,MInterestArea>(Table_Name, 5);
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MInterestArea.class);
|
private static CLogger s_log = CLogger.getCLogger (MInterestArea.class);
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MInventory> s_cache = new CCache<Integer,MInventory>("M_Inventory", 5, 5);
|
private static CCache<Integer,MInventory> s_cache = new CCache<Integer,MInventory>(Table_Name, 5, 5);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -250,7 +250,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MInvoice> s_cache = new CCache<Integer,MInvoice>("C_Invoice", 20, 2); // 2 minutes
|
private static CCache<Integer,MInvoice> s_cache = new CCache<Integer,MInvoice>(Table_Name, 20, 2); // 2 minutes
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class MInvoiceSchedule extends X_C_InvoiceSchedule
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MInvoiceSchedule> s_cache = new CCache<Integer,MInvoiceSchedule>("C_InvoiceSchedule", 5);
|
private static CCache<Integer,MInvoiceSchedule> s_cache = new CCache<Integer,MInvoiceSchedule>(Table_Name, 5);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class MLocation extends X_C_Location implements Comparator<Object>
|
||||||
} // getBPLocation
|
} // getBPLocation
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MLocation> s_cache = new CCache<Integer,MLocation>("C_Location", 100, 30);
|
private static CCache<Integer,MLocation> s_cache = new CCache<Integer,MLocation>(Table_Name, 100, 30);
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger(MLocation.class);
|
private static CLogger s_log = CLogger.getCLogger(MLocation.class);
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ public class MLocator extends X_M_Locator
|
||||||
public static MLocator get (Properties ctx, int M_Locator_ID)
|
public static MLocator get (Properties ctx, int M_Locator_ID)
|
||||||
{
|
{
|
||||||
if (s_cache == null)
|
if (s_cache == null)
|
||||||
s_cache = new CCache<Integer,MLocator>("M_Locator", 20);
|
s_cache = new CCache<Integer,MLocator>(Table_Name, 20);
|
||||||
Integer key = new Integer (M_Locator_ID);
|
Integer key = new Integer (M_Locator_ID);
|
||||||
MLocator retValue = (MLocator) s_cache.get (key);
|
MLocator retValue = (MLocator) s_cache.get (key);
|
||||||
if (retValue != null)
|
if (retValue != null)
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class MLookupCache
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger(MLookupCache.class);
|
private static CLogger s_log = CLogger.getCLogger(MLookupCache.class);
|
||||||
/** Static Lookup data with MLookupInfo -> HashMap */
|
/** Static Lookup data with MLookupInfo -> HashMap */
|
||||||
private static CCache<String,HashMap> s_loadedLookups = new CCache<String,HashMap>("MLookupCache", 50);
|
private static CCache<String,HashMap> s_loadedLookups = new CCache<String,HashMap>(null, "MLookupCache", 50, false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MLookup Loader starts loading - ignore for now
|
* MLookup Loader starts loading - ignore for now
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class MLookupFactory
|
||||||
/** Logging */
|
/** Logging */
|
||||||
private static CLogger s_log = CLogger.getCLogger(MLookupFactory.class);
|
private static CLogger s_log = CLogger.getCLogger(MLookupFactory.class);
|
||||||
/** Table Reference Cache */
|
/** Table Reference Cache */
|
||||||
private static CCache<String,MLookupInfo> s_cacheRefTable = new CCache<String,MLookupInfo>("AD_Ref_Table", 30, 60); // 1h
|
private static CCache<String,MLookupInfo> s_cacheRefTable = new CCache<String,MLookupInfo>(I_AD_Ref_Table.Table_Name, 30, 60); // 1h
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class MMailText extends X_R_MailText
|
||||||
/** Translated Text 3 */
|
/** Translated Text 3 */
|
||||||
private String m_MailText3 = null;
|
private String m_MailText3 = null;
|
||||||
/** Translation Cache */
|
/** Translation Cache */
|
||||||
private static CCache<String,MMailTextTrl> s_cacheTrl = new CCache<String,MMailTextTrl> ("", 20);
|
private static CCache<String,MMailTextTrl> s_cacheTrl = new CCache<String,MMailTextTrl> (Table_Name, 20);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get parsed/translated Mail Text
|
* Get parsed/translated Mail Text
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class MMeasure extends X_PA_Measure
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer, MMeasure> s_cache
|
private static CCache<Integer, MMeasure> s_cache
|
||||||
= new CCache<Integer, MMeasure> ("PA_Measure", 10);
|
= new CCache<Integer, MMeasure> (Table_Name, 10);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class MMeasureCalc extends X_PA_MeasureCalc
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer, MMeasureCalc> s_cache
|
private static CCache<Integer, MMeasureCalc> s_cache
|
||||||
= new CCache<Integer, MMeasureCalc> ("PA_MeasureCalc", 10);
|
= new CCache<Integer, MMeasureCalc> (Table_Name, 10);
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class MMessage extends X_AD_Message
|
||||||
} // getAD_Message_ID
|
} // getAD_Message_ID
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
static private CCache<String,MMessage> s_cache = new CCache<String,MMessage>("AD_Message", 100);
|
static private CCache<String,MMessage> s_cache = new CCache<String,MMessage>(Table_Name, 100);
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger(MMessage.class);
|
private static CLogger s_log = CLogger.getCLogger(MMessage.class);
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class MPOS extends X_C_POS
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MPOS> s_cache = new CCache<Integer,MPOS>("C_POS", 20);
|
private static CCache<Integer,MPOS> s_cache = new CCache<Integer,MPOS>(Table_Name, 20);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class MPOSKeyLayout extends X_C_POSKeyLayout
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MPOSKeyLayout> s_cache = new CCache<Integer,MPOSKeyLayout>("C_POSKeyLayout", 3);
|
private static CCache<Integer,MPOSKeyLayout> s_cache = new CCache<Integer,MPOSKeyLayout>(Table_Name, 3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class MPOSTerminal extends X_U_POSTerminal
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 6972567212871993024L;
|
private static final long serialVersionUID = 6972567212871993024L;
|
||||||
/** Cache */
|
/** Cache */
|
||||||
static private CCache<Integer,MPOSTerminal> s_cache = new CCache<Integer,MPOSTerminal>(X_U_POSTerminal.Table_Name, 10, 60);
|
static private CCache<Integer,MPOSTerminal> s_cache = new CCache<Integer,MPOSTerminal>(Table_Name, 10, 60);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ctx Context
|
* @param ctx Context
|
||||||
|
|
|
@ -321,7 +321,7 @@ public class MPeriod extends X_C_Period
|
||||||
} // getFirstInYear
|
} // getFirstInYear
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MPeriod> s_cache = new CCache<Integer,MPeriod>("C_Period", 10);
|
private static CCache<Integer,MPeriod> s_cache = new CCache<Integer,MPeriod>(Table_Name, 10);
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MPeriod.class);
|
private static CLogger s_log = CLogger.getCLogger (MPeriod.class);
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class MProcessPara extends X_AD_Process_Para
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer, MProcessPara> s_cache
|
private static CCache<Integer, MProcessPara> s_cache
|
||||||
= new CCache<Integer, MProcessPara> ("AD_Process_Para", 20);
|
= new CCache<Integer, MProcessPara> (Table_Name, 20);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -117,9 +117,9 @@ public class MProductCategory extends X_M_Product_Category
|
||||||
} // isCategory
|
} // isCategory
|
||||||
|
|
||||||
/** Categopry Cache */
|
/** Categopry Cache */
|
||||||
private static CCache<Integer,MProductCategory> s_cache = new CCache<Integer,MProductCategory>("M_Product_Category", 20);
|
private static CCache<Integer,MProductCategory> s_cache = new CCache<Integer,MProductCategory>(Table_Name, 20);
|
||||||
/** Product Cache */
|
/** Product Cache */
|
||||||
private static CCache<Integer,Integer> s_products = new CCache<Integer,Integer>("M_Product", 100);
|
private static CCache<Integer,Integer> s_products = new CCache<Integer,Integer>(I_M_Product.Table_Name, Table_Name + ".M_Product", 100);
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MProductCategory.class);
|
private static CLogger s_log = CLogger.getCLogger (MProductCategory.class);
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class MProjectType extends X_C_ProjectType
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer, MProjectType> s_cache
|
private static CCache<Integer, MProjectType> s_cache
|
||||||
= new CCache<Integer, MProjectType> ("C_ProjectType", 20);
|
= new CCache<Integer, MProjectType> (Table_Name, 20);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class MRecentItem extends X_AD_RecentItem
|
||||||
private static final long serialVersionUID = 8337619537799431984L;
|
private static final long serialVersionUID = 8337619537799431984L;
|
||||||
|
|
||||||
/** Recent Item Cache */
|
/** Recent Item Cache */
|
||||||
private static CCache<Integer,MRecentItem> s_cache = new CCache<Integer,MRecentItem>("AD_RecentItem", 10);
|
private static CCache<Integer,MRecentItem> s_cache = new CCache<Integer,MRecentItem>(Table_Name, 10);
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger(MRecentItem.class);
|
private static CLogger s_log = CLogger.getCLogger(MRecentItem.class);
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ public final class MRegion extends X_C_Region
|
||||||
*/
|
*/
|
||||||
private static void loadAllRegions (Properties ctx)
|
private static void loadAllRegions (Properties ctx)
|
||||||
{
|
{
|
||||||
s_regions = new CCache<String,MRegion>("C_Region", 100);
|
s_regions = new CCache<String,MRegion>(Table_Name, 100);
|
||||||
String sql = "SELECT * FROM C_Region WHERE IsActive='Y'";
|
String sql = "SELECT * FROM C_Region WHERE IsActive='Y'";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class MRegistrationAttribute extends X_A_RegistrationAttribute
|
||||||
private static CLogger s_log = CLogger.getCLogger(MRegistrationAttribute.class);
|
private static CLogger s_log = CLogger.getCLogger(MRegistrationAttribute.class);
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MRegistrationAttribute> s_cache
|
private static CCache<Integer,MRegistrationAttribute> s_cache
|
||||||
= new CCache<Integer,MRegistrationAttribute>("A_RegistrationAttribute", 20);
|
= new CCache<Integer,MRegistrationAttribute>(Table_Name, 20);
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class MRequestCategory extends X_R_Category
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MRequestCategory> s_cache
|
private static CCache<Integer,MRequestCategory> s_cache
|
||||||
= new CCache<Integer,MRequestCategory>("R_Category", 20);
|
= new CCache<Integer,MRequestCategory>(Table_Name, 20);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class MRequestType extends X_R_RequestType
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger(MRequestType.class);
|
private static CLogger s_log = CLogger.getCLogger(MRequestType.class);
|
||||||
/** Cache */
|
/** Cache */
|
||||||
static private CCache<Integer,MRequestType> s_cache = new CCache<Integer,MRequestType>("R_RequestType", 10);
|
static private CCache<Integer,MRequestType> s_cache = new CCache<Integer,MRequestType>(Table_Name, 10);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Default Request Type
|
* Get Default Request Type
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class MResolution extends X_R_Resolution
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MResolution> s_cache = new CCache<Integer,MResolution>("R_Resolution", 10);
|
private static CCache<Integer,MResolution> s_cache = new CCache<Integer,MResolution>(Table_Name, 10);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class MRfQ extends X_C_RfQ
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MRfQ> s_cache = new CCache<Integer,MRfQ>("C_RfQ", 10);
|
private static CCache<Integer,MRfQ> s_cache = new CCache<Integer,MRfQ>(Table_Name, 10);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class MRfQLine extends X_C_RfQLine
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MRfQLine> s_cache = new CCache<Integer,MRfQLine>("C_RfQLine", 20);
|
private static CCache<Integer,MRfQLine> s_cache = new CCache<Integer,MRfQLine>(Table_Name, 20);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class MRfQLineQty extends X_C_RfQLineQty
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MRfQLineQty> s_cache = new CCache<Integer,MRfQLineQty>("C_RfQLineQty", 20);
|
private static CCache<Integer,MRfQLineQty> s_cache = new CCache<Integer,MRfQLineQty>(Table_Name, 20);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
@ -235,7 +235,7 @@ public final class MRole extends X_AD_Role
|
||||||
} // getOf
|
} // getOf
|
||||||
|
|
||||||
/** Role/User Cache */
|
/** Role/User Cache */
|
||||||
private static CCache<String,MRole> s_roles = new CCache<String,MRole>("AD_Role", 5);
|
private static CCache<String,MRole> s_roles = new CCache<String,MRole>(Table_Name, 5);
|
||||||
/** Log */
|
/** Log */
|
||||||
private static CLogger s_log = CLogger.getCLogger(MRole.class);
|
private static CLogger s_log = CLogger.getCLogger(MRole.class);
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class MRule extends X_AD_Rule
|
||||||
} // getModelValidatorLoginRules
|
} // getModelValidatorLoginRules
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MRule> s_cache = new CCache<Integer,MRule>("AD_Rule", 20);
|
private static CCache<Integer,MRule> s_cache = new CCache<Integer,MRule>(Table_Name, 20);
|
||||||
|
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MRule.class);
|
private static CLogger s_log = CLogger.getCLogger (MRule.class);
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class MSLACriteria extends X_PA_SLA_Criteria
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MSLACriteria> s_cache = new CCache<Integer,MSLACriteria>("PA_SLA_Criteria", 20);
|
private static CCache<Integer,MSLACriteria> s_cache = new CCache<Integer,MSLACriteria>(Table_Name, 20);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class MSalesRegion extends X_C_SalesRegion
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MSalesRegion> s_cache = new CCache<Integer,MSalesRegion>("C_SalesRegion", 10);
|
private static CCache<Integer,MSalesRegion> s_cache = new CCache<Integer,MSalesRegion>(Table_Name, 10);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class MSchedule extends X_AD_Schedule
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer, MSchedule> s_cache = new CCache<Integer, MSchedule> ("AD_Schedule", 10);
|
private static CCache<Integer, MSchedule> s_cache = new CCache<Integer, MSchedule> (Table_Name, 10);
|
||||||
|
|
||||||
public boolean chekIPFormat(String ipOnly)
|
public boolean chekIPFormat(String ipOnly)
|
||||||
{
|
{
|
||||||
|
|
|
@ -108,8 +108,8 @@ public class MSession extends X_AD_Session
|
||||||
|
|
||||||
/** Sessions */
|
/** Sessions */
|
||||||
private static CCache<Integer, MSession> s_sessions = Ini.isClient()
|
private static CCache<Integer, MSession> s_sessions = Ini.isClient()
|
||||||
? new CCache<Integer, MSession>("AD_Session_ID", 1, 0) // one client session
|
? new CCache<Integer, MSession>(null, "AD_Session_ID", 1, 0, false) // one client session
|
||||||
: new CCache<Integer, MSession>("AD_Session_ID", 30, 0); // no time-out
|
: new CCache<Integer, MSession>(null, "AD_Session_ID", 30, 0, false); // no time-out
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -157,10 +157,10 @@ public class MStatus extends X_R_Status
|
||||||
private static CLogger s_log = CLogger.getCLogger(MStatus.class);
|
private static CLogger s_log = CLogger.getCLogger(MStatus.class);
|
||||||
/** Cache */
|
/** Cache */
|
||||||
static private CCache<Integer,MStatus> s_cache
|
static private CCache<Integer,MStatus> s_cache
|
||||||
= new CCache<Integer,MStatus> ("R_Status", 10);
|
= new CCache<Integer,MStatus> (Table_Name, 10);
|
||||||
/** Default Cache (Key=Client) */
|
/** Default Cache (Key=Client) */
|
||||||
static private CCache<Integer,MStatus> s_cacheDefault
|
static private CCache<Integer,MStatus> s_cacheDefault
|
||||||
= new CCache<Integer,MStatus>("R_Status", 10);
|
= new CCache<Integer,MStatus>(Table_Name, "R_Status_Default", 10);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class MStatusCategory extends X_R_StatusCategory
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer, MStatusCategory> s_cache
|
private static CCache<Integer, MStatusCategory> s_cache
|
||||||
= new CCache<Integer, MStatusCategory> ("R_StatusCategory", 20);
|
= new CCache<Integer, MStatusCategory> (Table_Name, 20);
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MStatusCategory.class);
|
private static CLogger s_log = CLogger.getCLogger (MStatusCategory.class);
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ public class MStore extends X_W_Store
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MStore> s_cache
|
private static CCache<Integer,MStore> s_cache
|
||||||
= new CCache<Integer,MStore>("W_Store", 2);
|
= new CCache<Integer,MStore>(Table_Name, 2);
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MStore.class);
|
private static CLogger s_log = CLogger.getCLogger (MStore.class);
|
||||||
|
|
||||||
|
|
|
@ -135,17 +135,8 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MSysConfig.class);
|
private static CLogger s_log = CLogger.getCLogger (MSysConfig.class);
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<String, String> s_cache = new CCache<String, String>(Table_Name, 40, 0);
|
private static CCache<String, String> s_cache = new CCache<String, String>(Table_Name, 40, 0, true);
|
||||||
/** resetCache */
|
|
||||||
private static boolean resetCache = false;
|
|
||||||
|
|
||||||
/** Reset Cache
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static void resetCache()
|
|
||||||
{
|
|
||||||
s_cache.reset();
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Get system configuration property of type string
|
* Get system configuration property of type string
|
||||||
* @param Name
|
* @param Name
|
||||||
|
|
|
@ -149,7 +149,7 @@ public class MTable extends X_AD_Table
|
||||||
|
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MTable> s_cache = new CCache<Integer,MTable>("AD_Table", 20);
|
private static CCache<Integer,MTable> s_cache = new CCache<Integer,MTable>(Table_Name, 20);
|
||||||
|
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MTable.class);
|
private static CLogger s_log = CLogger.getCLogger (MTable.class);
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class MTableScriptValidator extends X_AD_Table_ScriptValidator
|
||||||
= new CCache<Integer,MTableScriptValidator>(Table_Name, 20);
|
= new CCache<Integer,MTableScriptValidator>(Table_Name, 20);
|
||||||
/** Cache / Table Event */
|
/** Cache / Table Event */
|
||||||
private static CCache<MultiKey,List<MTableScriptValidator>> s_cacheTableEvent
|
private static CCache<MultiKey,List<MTableScriptValidator>> s_cacheTableEvent
|
||||||
= new CCache<MultiKey,List<MTableScriptValidator>>(Table_Name+"_TableEvent", 20);
|
= new CCache<MultiKey,List<MTableScriptValidator>>(null, Table_Name+"_TableEvent", 20, false);
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class MTax extends X_C_Tax
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MTax> s_cache = new CCache<Integer,MTax>(Table_Name, 5);
|
private static CCache<Integer,MTax> s_cache = new CCache<Integer,MTax>(Table_Name, 5);
|
||||||
/** Cache of Client */
|
/** Cache of Client */
|
||||||
private static CCache<Integer,MTax[]> s_cacheAll = new CCache<Integer,MTax[]>(Table_Name, 5);
|
private static CCache<Integer,MTax[]> s_cacheAll = new CCache<Integer,MTax[]>(Table_Name, Table_Name+"_Of_Client", 5);
|
||||||
|
|
||||||
/** 100 */
|
/** 100 */
|
||||||
private static BigDecimal ONEHUNDRED = new BigDecimal(100);
|
private static BigDecimal ONEHUNDRED = new BigDecimal(100);
|
||||||
|
|
|
@ -219,7 +219,7 @@ public class MTree_Base extends X_AD_Tree
|
||||||
|
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MTree_Base> s_cache = new CCache<Integer,MTree_Base>("AD_Tree", 10);
|
private static CCache<Integer,MTree_Base> s_cache = new CCache<Integer,MTree_Base>(Table_Name, 10);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -169,7 +169,7 @@ public class MUOMConversion extends X_C_UOM_Conversion
|
||||||
*/
|
*/
|
||||||
private static void createRates (Properties ctx)
|
private static void createRates (Properties ctx)
|
||||||
{
|
{
|
||||||
s_conversions = new CCache<Point,BigDecimal>("C_UOMConversion", 20);
|
s_conversions = new CCache<Point,BigDecimal>(Table_Name, 20);
|
||||||
//
|
//
|
||||||
String sql = MRole.getDefault(ctx, false).addAccessSQL (
|
String sql = MRole.getDefault(ctx, false).addAccessSQL (
|
||||||
"SELECT C_UOM_ID, C_UOM_To_ID, MultiplyRate, DivideRate "
|
"SELECT C_UOM_ID, C_UOM_To_ID, MultiplyRate, DivideRate "
|
||||||
|
@ -625,7 +625,7 @@ public class MUOMConversion extends X_C_UOM_Conversion
|
||||||
private static CCache<Point,BigDecimal> s_conversions = null;
|
private static CCache<Point,BigDecimal> s_conversions = null;
|
||||||
/** Product Conversion Map */
|
/** Product Conversion Map */
|
||||||
private static final CCache<Integer,MUOMConversion[]> s_conversionProduct
|
private static final CCache<Integer,MUOMConversion[]> s_conversionProduct
|
||||||
= new CCache<Integer,MUOMConversion[]>("C_UOMConversion", 20);
|
= new CCache<Integer,MUOMConversion[]>(Table_Name, Table_Name+"_Of_Product", 20);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -275,7 +275,7 @@ public class MUser extends X_AD_User
|
||||||
} // isSalesRep
|
} // isSalesRep
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
static private CCache<Integer,MUser> s_cache = new CCache<Integer,MUser>("AD_User", 30, 60);
|
static private CCache<Integer,MUser> s_cache = new CCache<Integer,MUser>(Table_Name, 30, 60);
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MUser.class);
|
private static CLogger s_log = CLogger.getCLogger (MUser.class);
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class MUserDefWin extends X_AD_UserDef_Win
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Cache of selected MUserDefWin entries **/
|
/** Cache of selected MUserDefWin entries **/
|
||||||
private static CCache<Integer,MUserDefWin> s_cache = new CCache<Integer,MUserDefWin>("AD_UserDef_Win", 3); // 3 weights
|
private static CCache<Integer,MUserDefWin> s_cache = new CCache<Integer,MUserDefWin>(Table_Name, 3); // 3 weights
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean beforeSave(boolean newRecord) {
|
protected boolean beforeSave(boolean newRecord) {
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class MWarehouse extends X_M_Warehouse
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MWarehouse> s_cache = new CCache<Integer,MWarehouse>("M_Warehouse", 50 );
|
private static CCache<Integer,MWarehouse> s_cache = new CCache<Integer,MWarehouse>(Table_Name, 50 );
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class MWebProject extends X_CM_WebProject
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer, MWebProject> s_cache
|
private static CCache<Integer, MWebProject> s_cache
|
||||||
= new CCache<Integer, MWebProject> ("CM_WebProject", 5);
|
= new CCache<Integer, MWebProject> (Table_Name, 5);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -634,7 +634,7 @@ public class ModelValidationEngine
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Add Date Import Validation Listener
|
* Add Date Import Validation Listener
|
||||||
* @param tableName table name
|
* @param data.tableName table name
|
||||||
* @param listener listener
|
* @param listener listener
|
||||||
*/
|
*/
|
||||||
public void addImportValidate (String importTableName, ImportValidator listener)
|
public void addImportValidate (String importTableName, ImportValidator listener)
|
||||||
|
|
|
@ -69,7 +69,7 @@ public final class NaturalAccountMap<K,V> extends CCache<K,V>
|
||||||
*/
|
*/
|
||||||
public NaturalAccountMap(Properties ctx, String trxName)
|
public NaturalAccountMap(Properties ctx, String trxName)
|
||||||
{
|
{
|
||||||
super("NaturalAccountMap", 100);
|
super(null, "NaturalAccountMap", 100, false);
|
||||||
m_ctx = ctx;
|
m_ctx = ctx;
|
||||||
m_trxName = trxName;
|
m_trxName = trxName;
|
||||||
} // NaturalAccountMap
|
} // NaturalAccountMap
|
||||||
|
|
|
@ -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.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -4301,5 +4303,10 @@ public abstract class PO
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void readObject(ObjectInputStream ois)
|
||||||
|
throws ClassNotFoundException, IOException {
|
||||||
|
// default deserialization
|
||||||
|
ois.defaultReadObject();
|
||||||
|
log = CLogger.getCLogger(getClass());
|
||||||
|
}
|
||||||
} // PO
|
} // PO
|
||||||
|
|
|
@ -86,7 +86,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>("POInfo", 200);
|
private static CCache<Integer,POInfo> s_cache = new CCache<Integer,POInfo>(I_AD_Table.Table_Name, "POInfo", 200);
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Create Persistent Info
|
* Create Persistent Info
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class TranslationTable
|
||||||
private static Integer s_activeLanguages = null;
|
private static Integer s_activeLanguages = null;
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<String,TranslationTable> s_cache = new CCache<String,TranslationTable>("TranslationTable", 20);
|
private static CCache<String,TranslationTable> s_cache = new CCache<String,TranslationTable>(null, "TranslationTable", 20, true);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class MPrintColor extends X_AD_PrintColor
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
/** Cached Colors */
|
/** Cached Colors */
|
||||||
static private CCache<Integer,MPrintColor> s_colors = new CCache<Integer,MPrintColor>("AD_PrintColor", 20);
|
static private CCache<Integer,MPrintColor> s_colors = new CCache<Integer,MPrintColor>(Table_Name, 20);
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MPrintColor.class);
|
private static CLogger s_log = CLogger.getCLogger (MPrintColor.class);
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ public class MPrintFont extends X_AD_PrintFont
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
/** Cached Fonts */
|
/** Cached Fonts */
|
||||||
static private CCache<Integer,MPrintFont> s_fonts = new CCache<Integer,MPrintFont>("AD_PrintFont", 20);
|
static private CCache<Integer,MPrintFont> s_fonts = new CCache<Integer,MPrintFont>(Table_Name, 20);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Font
|
* Get Font
|
||||||
|
|
|
@ -1035,7 +1035,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
/** Cached Formats */
|
/** Cached Formats */
|
||||||
static private CCache<Integer,MPrintFormat> s_formats = new CCache<Integer,MPrintFormat>("AD_PrintFormat", 30);
|
static private CCache<Integer,MPrintFormat> s_formats = new CCache<Integer,MPrintFormat>(Table_Name, 30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Format
|
* Get Format
|
||||||
|
|
|
@ -383,7 +383,7 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem
|
||||||
|
|
||||||
|
|
||||||
/** Lookup Map of AD_Column_ID for ColumnName */
|
/** Lookup Map of AD_Column_ID for ColumnName */
|
||||||
private static CCache<Integer,String> s_columns = new CCache<Integer,String>("AD_PrintFormatItem", 200);
|
private static CCache<Integer,String> s_columns = new CCache<Integer,String>(Table_Name, 200);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ColumnName from AD_Column_ID
|
* Get ColumnName from AD_Column_ID
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class MPrintPaper extends X_AD_PrintPaper
|
||||||
private static CLogger s_log = CLogger.getCLogger(MPrintPaper.class);
|
private static CLogger s_log = CLogger.getCLogger(MPrintPaper.class);
|
||||||
/** Cached Fonts */
|
/** Cached Fonts */
|
||||||
static private CCache<Integer,MPrintPaper> s_papers
|
static private CCache<Integer,MPrintPaper> s_papers
|
||||||
= new CCache<Integer,MPrintPaper>("AD_PrintPaper", 5);
|
= new CCache<Integer,MPrintPaper>(Table_Name, 5);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -536,7 +536,7 @@ public class MPrintTableFormat extends X_AD_PrintTableFormat
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
private static CCache<Integer,MPrintTableFormat> s_cache
|
private static CCache<Integer,MPrintTableFormat> s_cache
|
||||||
= new CCache<Integer,MPrintTableFormat>("AD_PrintTableFormat", 3);
|
= new CCache<Integer,MPrintTableFormat>(Table_Name, 3);
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger(MPrintTableFormat.class);
|
private static CLogger s_log = CLogger.getCLogger(MPrintTableFormat.class);
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class ImageElement extends PrintElement
|
||||||
|
|
||||||
/** 60 minute Cache */
|
/** 60 minute Cache */
|
||||||
private static CCache<Object,ImageElement> s_cache
|
private static CCache<Object,ImageElement> s_cache
|
||||||
= new CCache<Object,ImageElement>("ImageElement", 10, 60);
|
= new CCache<Object,ImageElement>(null, "ImageElement", 10, 60, false);
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Create from existing Image
|
* Create from existing Image
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class MReportTree
|
||||||
} // getChildIDs
|
} // getChildIDs
|
||||||
|
|
||||||
/** Map with Tree */
|
/** Map with Tree */
|
||||||
private static CCache<String,MReportTree> s_trees = new CCache<String,MReportTree>("MReportTree", 20);
|
private static CCache<String,MReportTree> s_trees = new CCache<String,MReportTree>(null, "MReportTree", 20, false);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -18,36 +18,66 @@ package org.compiere.util;
|
||||||
|
|
||||||
import java.beans.VetoableChangeListener;
|
import java.beans.VetoableChangeListener;
|
||||||
import java.beans.VetoableChangeSupport;
|
import java.beans.VetoableChangeSupport;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.adempiere.base.Service;
|
||||||
|
import org.idempiere.distributed.ICacheService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adempiere Cache.
|
* Cache for table.
|
||||||
* @param <K> Key
|
* @param <K> Key
|
||||||
* @param <V> Value
|
* @param <V> Value
|
||||||
*
|
*
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: CCache.java,v 1.2 2006/07/30 00:54:35 jjanke Exp $
|
* @version $Id: CCache.java,v 1.2 2006/07/30 00:54:35 jjanke Exp $
|
||||||
*/
|
*/
|
||||||
public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
public class CCache<K,V> implements CacheInterface, Map<K, V>, Serializable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -2268565219001179841L;
|
private static final long serialVersionUID = -2268565219001179841L;
|
||||||
|
|
||||||
|
private Map<K, V> cache = null;
|
||||||
|
|
||||||
|
private Set<K> nullList = null;
|
||||||
|
|
||||||
|
private String m_tableName;
|
||||||
|
|
||||||
|
private boolean m_distributed;
|
||||||
|
|
||||||
|
public CCache (String name, int initialCapacity)
|
||||||
|
{
|
||||||
|
this(name, name, initialCapacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CCache (String name, int initialCapacity, int expireMinutes)
|
||||||
|
{
|
||||||
|
this(name, initialCapacity, expireMinutes, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CCache (String name, int initialCapacity, int expireMinutes, boolean distributed)
|
||||||
|
{
|
||||||
|
this(name, name, initialCapacity, expireMinutes, distributed);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adempiere Cache - expires after 2 hours
|
* Adempiere Cache - expires after 2 hours
|
||||||
* @param name (table) name of the cache
|
* @param name (table) name of the cache
|
||||||
* @param initialCapacity initial capacity
|
* @param initialCapacity initial capacity
|
||||||
*/
|
*/
|
||||||
public CCache (String name, int initialCapacity)
|
public CCache (String tableName, String name, int initialCapacity)
|
||||||
{
|
{
|
||||||
this (name, initialCapacity, 120);
|
this (tableName, name, initialCapacity, false);
|
||||||
} // CCache
|
} // CCache
|
||||||
|
|
||||||
|
public CCache (String tableName, String name, int initialCapacity, boolean distributed)
|
||||||
|
{
|
||||||
|
this (tableName, name, initialCapacity, 120, distributed);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adempiere Cache
|
* Adempiere Cache
|
||||||
|
@ -55,12 +85,20 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
* @param initialCapacity initial capacity
|
* @param initialCapacity initial capacity
|
||||||
* @param expireMinutes expire after minutes (0=no expire)
|
* @param expireMinutes expire after minutes (0=no expire)
|
||||||
*/
|
*/
|
||||||
public CCache (String name, int initialCapacity, int expireMinutes)
|
public CCache (String tableName, String name, int initialCapacity, int expireMinutes, boolean distributed)
|
||||||
{
|
{
|
||||||
super(initialCapacity);
|
// super(initialCapacity);
|
||||||
m_name = name;
|
m_name = name;
|
||||||
|
m_tableName = tableName;
|
||||||
setExpireMinutes(expireMinutes);
|
setExpireMinutes(expireMinutes);
|
||||||
CacheMgt.get().register(this);
|
cache = CacheMgt.get().register(this, distributed);
|
||||||
|
m_distributed = distributed;
|
||||||
|
if (distributed) {
|
||||||
|
ICacheService provider = Service.locator().locate(ICacheService.class).getService();
|
||||||
|
if (provider != null) {
|
||||||
|
nullList = provider.getSet(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // CCache
|
} // CCache
|
||||||
|
|
||||||
/** Name */
|
/** Name */
|
||||||
|
@ -86,6 +124,11 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
return m_name;
|
return m_name;
|
||||||
} // getName
|
} // getName
|
||||||
|
|
||||||
|
public String getTableName()
|
||||||
|
{
|
||||||
|
return m_tableName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Expire Minutes and start it
|
* Set Expire Minutes and start it
|
||||||
* @param expireMinutes minutes or 0
|
* @param expireMinutes minutes or 0
|
||||||
|
@ -138,7 +181,7 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
*/
|
*/
|
||||||
public int reset()
|
public int reset()
|
||||||
{
|
{
|
||||||
int no = super.size();
|
int no = cache.size();
|
||||||
clear();
|
clear();
|
||||||
return no;
|
return no;
|
||||||
} // reset
|
} // reset
|
||||||
|
@ -163,7 +206,7 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
{
|
{
|
||||||
return "CCache[" + m_name
|
return "CCache[" + m_name
|
||||||
+ ",Exp=" + getExpireMinutes()
|
+ ",Exp=" + getExpireMinutes()
|
||||||
+ ", #" + super.size() + "]";
|
+ ", #" + cache.size() + "]";
|
||||||
} // toString
|
} // toString
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,7 +219,7 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_changeSupport.fireVetoableChange(PROPERTYNAME, super.size(), 0);
|
m_changeSupport.fireVetoableChange(PROPERTYNAME, cache.size(), 0);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -185,7 +228,7 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Clear
|
// Clear
|
||||||
super.clear();
|
cache.clear();
|
||||||
if (m_expire != 0)
|
if (m_expire != 0)
|
||||||
{
|
{
|
||||||
long addMS = 60000L * m_expire;
|
long addMS = 60000L * m_expire;
|
||||||
|
@ -201,7 +244,14 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
public boolean containsKey(Object key)
|
public boolean containsKey(Object key)
|
||||||
{
|
{
|
||||||
expire();
|
expire();
|
||||||
return super.containsKey(key);
|
if (nullList != null)
|
||||||
|
{
|
||||||
|
return cache.containsKey(key) || nullList.contains(key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return cache.containsKey(key);
|
||||||
|
}
|
||||||
} // containsKey
|
} // containsKey
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -210,7 +260,7 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
public boolean containsValue(Object value)
|
public boolean containsValue(Object value)
|
||||||
{
|
{
|
||||||
expire();
|
expire();
|
||||||
return super.containsValue(value);
|
return cache.containsValue(value);
|
||||||
} // containsValue
|
} // containsValue
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -219,7 +269,7 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
public Set<Map.Entry<K,V>> entrySet()
|
public Set<Map.Entry<K,V>> entrySet()
|
||||||
{
|
{
|
||||||
expire();
|
expire();
|
||||||
return super.entrySet();
|
return cache.entrySet();
|
||||||
} // entrySet
|
} // entrySet
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -228,7 +278,7 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
public V get(Object key)
|
public V get(Object key)
|
||||||
{
|
{
|
||||||
expire();
|
expire();
|
||||||
return super.get(key);
|
return cache.get(key);
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -241,7 +291,13 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
{
|
{
|
||||||
expire();
|
expire();
|
||||||
m_justReset = false;
|
m_justReset = false;
|
||||||
return super.put (key, value);
|
if (value == null && m_distributed && nullList != null) {
|
||||||
|
cache.remove(key);
|
||||||
|
if (!nullList.contains(key))
|
||||||
|
nullList.add(key);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return cache.put (key, value);
|
||||||
} // put
|
} // put
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -252,7 +308,7 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
{
|
{
|
||||||
expire();
|
expire();
|
||||||
m_justReset = false;
|
m_justReset = false;
|
||||||
super.putAll (m);
|
cache.putAll (m);
|
||||||
} // putAll
|
} // putAll
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -261,7 +317,7 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
public boolean isEmpty()
|
public boolean isEmpty()
|
||||||
{
|
{
|
||||||
expire();
|
expire();
|
||||||
return super.isEmpty();
|
return cache.isEmpty();
|
||||||
} // isEmpty
|
} // isEmpty
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -270,7 +326,7 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
public Set<K> keySet()
|
public Set<K> keySet()
|
||||||
{
|
{
|
||||||
expire();
|
expire();
|
||||||
return super.keySet();
|
return cache.keySet();
|
||||||
} // keySet
|
} // keySet
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -279,7 +335,7 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
public int size()
|
public int size()
|
||||||
{
|
{
|
||||||
expire();
|
expire();
|
||||||
return super.size();
|
return cache.size();
|
||||||
} // size
|
} // size
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -289,7 +345,7 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
*/
|
*/
|
||||||
public int sizeNoExpire()
|
public int sizeNoExpire()
|
||||||
{
|
{
|
||||||
return super.size();
|
return cache.size();
|
||||||
} // size
|
} // size
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -298,7 +354,7 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
public Collection<V> values()
|
public Collection<V> values()
|
||||||
{
|
{
|
||||||
expire();
|
expire();
|
||||||
return super.values();
|
return cache.values();
|
||||||
} // values
|
} // values
|
||||||
|
|
||||||
|
|
||||||
|
@ -324,4 +380,19 @@ public class CCache<K,V> extends HashMap<K,V> implements CacheInterface
|
||||||
m_changeSupport.removeVetoableChangeListener(listener);
|
m_changeSupport.removeVetoableChangeListener(listener);
|
||||||
} // removeVetoableChangeListener
|
} // removeVetoableChangeListener
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public V remove(Object key) {
|
||||||
|
return cache.remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int reset(int recordId) {
|
||||||
|
if (recordId < 0)
|
||||||
|
return reset();
|
||||||
|
|
||||||
|
V removed = cache.remove(recordId);
|
||||||
|
return removed != null ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // CCache
|
} // CCache
|
||||||
|
|
|
@ -30,6 +30,12 @@ public interface CacheInterface
|
||||||
*/
|
*/
|
||||||
public int reset();
|
public int reset();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset Cache
|
||||||
|
* @return number of items reset
|
||||||
|
*/
|
||||||
|
public int reset(int recordId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Size of Cache
|
* Get Size of Cache
|
||||||
* @return number of items
|
* @return number of items
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue