IDEMPIERE-4072 iDempiere Monitor: Implement server and cache details for cluster node. Fixed multiple message cache instance. Improve naming of cache.
This commit is contained in:
parent
1106927690
commit
31dd08b595
|
@ -137,7 +137,7 @@ public class MAcctSchema extends X_C_AcctSchema
|
|||
} // getClientAcctSchema
|
||||
|
||||
/** Cache of Client AcctSchema Arrays **/
|
||||
private static CCache<Integer,MAcctSchema[]> s_schema = new CCache<Integer,MAcctSchema[]>(I_AD_ClientInfo.Table_Name, 3, 120, true); // 3 clients
|
||||
private static CCache<Integer,MAcctSchema[]> s_schema = new CCache<Integer,MAcctSchema[]>(I_AD_ClientInfo.Table_Name, I_AD_ClientInfo.Table_Name+"|MAcctSchema[]", 3, 120, true); // 3 clients
|
||||
/** Cache of AcctSchemas **/
|
||||
private static CCache<Integer,MAcctSchema> s_cache = new CCache<Integer,MAcctSchema>(Table_Name, 3, 120, true); // 3 accounting schemas
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public class MAlertProcessor extends X_AD_AlertProcessor
|
|||
} // MAlertProcessor
|
||||
|
||||
/** Cache: AD_AlertProcessor -> Alerts array */
|
||||
private static CCache<Integer, MAlert[]> s_cacheAlerts = new CCache<Integer, MAlert[]>(I_AD_Alert.Table_Name, "AD_Alert_ForProcessor", 10, false);
|
||||
private static CCache<Integer, MAlert[]> s_cacheAlerts = new CCache<Integer, MAlert[]>(I_AD_Alert.Table_Name, "AD_Alert|AlertProcessor", 10, false);
|
||||
|
||||
/**
|
||||
* Get Server ID
|
||||
|
|
|
@ -113,12 +113,13 @@ public class MCountry extends X_C_Country
|
|||
* Set Default Language to Client Language
|
||||
* @param ctx context
|
||||
*/
|
||||
private static void loadAllCountries (Properties ctx)
|
||||
private static synchronized void loadAllCountries (Properties ctx)
|
||||
{
|
||||
MClient client = MClient.get (ctx);
|
||||
MLanguage lang = MLanguage.get(ctx, client.getAD_Language());
|
||||
//
|
||||
s_countries = new CCache<Integer,MCountry>(Table_Name, 250);
|
||||
if (s_countries == null)
|
||||
s_countries = new CCache<Integer,MCountry>(Table_Name, 250);
|
||||
List<MCountry> countries = new Query(ctx, Table_Name, "", null)
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
|
@ -183,7 +184,7 @@ public class MCountry extends X_C_Country
|
|||
/** Country Cache */
|
||||
private static CCache<Integer,MCountry> s_countries = null;
|
||||
/** Default Country */
|
||||
private static CCache<Integer,MCountry> s_default = new CCache<Integer,MCountry>(Table_Name, 3);
|
||||
private static CCache<Integer,MCountry> s_default = new CCache<Integer,MCountry>(Table_Name, Table_Name+"|Default", 3);
|
||||
/** Static Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger (MCountry.class);
|
||||
// Default DisplaySequence */
|
||||
|
|
|
@ -106,7 +106,7 @@ public class MProcess extends X_AD_Process
|
|||
/** Cache ID */
|
||||
private static CCache<Integer,MProcess> s_cache = new CCache<Integer,MProcess>(Table_Name, 20);
|
||||
/** Cache UUID */
|
||||
private static CCache<String,MProcess> s_cacheUU = new CCache<String,MProcess>(Table_Name, 20);
|
||||
private static CCache<String,MProcess> s_cacheUU = new CCache<String,MProcess>(Table_Name, Table_Name+"|AD_Process_UU", 20);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
|
|
|
@ -115,7 +115,7 @@ public class MProductCategory extends X_M_Product_Category
|
|||
/** Categopry Cache */
|
||||
private static CCache<Integer,MProductCategory> s_cache = new CCache<Integer,MProductCategory>(Table_Name, 20);
|
||||
/** Product Cache */
|
||||
private static CCache<Integer,Integer> s_products = new CCache<Integer,Integer>(I_M_Product.Table_Name, Table_Name + ".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 */
|
||||
private static CLogger s_log = CLogger.getCLogger (MProductCategory.class);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class MStatusLine extends X_AD_StatusLine
|
|||
private static CLogger s_log = CLogger.getCLogger(MStatusLine.class);
|
||||
/** Status Line Cache */
|
||||
private static CCache<String, MStatusLine> s_cache = new CCache<String, MStatusLine>(Table_Name, 10);
|
||||
private static CCache<String, MStatusLine[]> s_cachew = new CCache<String, MStatusLine[]>(Table_Name, 10);
|
||||
private static CCache<String, MStatusLine[]> s_cachew = new CCache<String, MStatusLine[]>(Table_Name, Table_Name+"|MStatusLine[]", 10);
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
|
|
|
@ -1890,7 +1890,7 @@ public abstract class PO
|
|||
} // setAD_User_ID
|
||||
|
||||
/** Cache */
|
||||
private static CCache<String,String> trl_cache = new CCache<String,String>("po_trl", 5);
|
||||
private static CCache<String,String> trl_cache = new CCache<String,String>("PO_Trl", 5);
|
||||
|
||||
public String get_Translation (String columnName, String AD_Language)
|
||||
{
|
||||
|
|
|
@ -1936,7 +1936,7 @@ public final class Env
|
|||
|
||||
/** Window Cache */
|
||||
private static CCache<Integer,GridWindowVO> s_windowsvo
|
||||
= new CCache<Integer,GridWindowVO>(I_AD_Window.Table_Name, 10);
|
||||
= new CCache<Integer,GridWindowVO>(I_AD_Window.Table_Name, I_AD_Window.Table_Name+"|GridWindowVO", 10);
|
||||
|
||||
/**
|
||||
* Get Window Model
|
||||
|
|
|
@ -21,11 +21,14 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.model.I_AD_Element;
|
||||
import org.compiere.model.I_AD_Message;
|
||||
|
||||
/**
|
||||
|
@ -67,18 +70,18 @@ public final class Msg
|
|||
} // Mag
|
||||
|
||||
/** The Map */
|
||||
private CCache<String,CCache<String,String>> m_languages
|
||||
= new CCache<String,CCache<String,String>>(null, "msg_lang", 2, 0, false);
|
||||
private Map<String,CCache<String,String>> m_languages
|
||||
= new HashMap<String, CCache<String,String>>();
|
||||
|
||||
private CCache<String,CCache<String,String>> m_elementCache
|
||||
= new CCache<String,CCache<String,String>>(null, "msg_element", 2, 0, false);
|
||||
private Map<String,CCache<String,String>> m_elementCache
|
||||
= new HashMap<String,CCache<String,String>>();
|
||||
|
||||
/**
|
||||
* Get Language specific Message Map
|
||||
* @param ad_language Language Key
|
||||
* @return HashMap of Language
|
||||
*/
|
||||
private CCache<String,String> getMsgMap (String ad_language)
|
||||
private synchronized CCache<String,String> getMsgMap (String ad_language)
|
||||
{
|
||||
String AD_Language = ad_language;
|
||||
if (AD_Language == null || AD_Language.length() == 0)
|
||||
|
@ -89,7 +92,7 @@ public final class Msg
|
|||
return retValue;
|
||||
|
||||
// Load Language
|
||||
retValue = initMsg(AD_Language);
|
||||
retValue = initMsg(AD_Language, retValue);
|
||||
if (retValue != null)
|
||||
{
|
||||
m_languages.put(AD_Language, retValue);
|
||||
|
@ -98,17 +101,17 @@ public final class Msg
|
|||
return retValue;
|
||||
} // getMsgMap
|
||||
|
||||
private CCache<String,String> getElementMap (String ad_language)
|
||||
private synchronized CCache<String,String> getElementMap (String ad_language)
|
||||
{
|
||||
String AD_Language = ad_language;
|
||||
if (AD_Language == null || AD_Language.length() == 0)
|
||||
AD_Language = Language.getBaseAD_Language();
|
||||
// Do we have the language ?
|
||||
CCache<String,String> retValue = (CCache<String,String>)m_elementCache.get(AD_Language);
|
||||
if (retValue != null && retValue.size() > 0)
|
||||
if (retValue != null)
|
||||
return retValue;
|
||||
|
||||
retValue = new CCache<String, String>("element", 100, 0, false, 0);
|
||||
retValue = new CCache<String, String>(I_AD_Element.Table_Name, I_AD_Element.Table_Name + "|" + AD_Language, 100, 0, false, 0);
|
||||
m_elementCache.put(AD_Language, retValue);
|
||||
return retValue;
|
||||
}
|
||||
|
@ -121,10 +124,10 @@ public final class Msg
|
|||
* @param AD_Language Language
|
||||
* @return Cache HashMap
|
||||
*/
|
||||
private CCache<String,String> initMsg (String AD_Language)
|
||||
private CCache<String,String> initMsg (String AD_Language, CCache<String,String> msg)
|
||||
{
|
||||
// Trace.printStack();
|
||||
CCache<String,String> msg = new CCache<String,String>(I_AD_Message.Table_Name, MAP_SIZE, 0, false, 0);
|
||||
if (msg == null)
|
||||
msg = new CCache<String,String>(I_AD_Message.Table_Name, I_AD_Message.Table_Name + "|" + AD_Language, MAP_SIZE, 0, false, 0);
|
||||
//
|
||||
if (!DB.isConnected())
|
||||
{
|
||||
|
@ -183,7 +186,7 @@ public final class Msg
|
|||
/**
|
||||
* Reset Message cache
|
||||
*/
|
||||
public void reset()
|
||||
public synchronized void reset()
|
||||
{
|
||||
if (m_languages == null)
|
||||
return;
|
||||
|
@ -195,14 +198,13 @@ public final class Msg
|
|||
CCache<String, String> hm = iterator.next();
|
||||
hm.reset();
|
||||
}
|
||||
m_languages.clear();
|
||||
} // reset
|
||||
|
||||
/**
|
||||
* Return an array of the installed Languages
|
||||
* @return Array of loaded Languages or null
|
||||
*/
|
||||
public String[] getLanguages()
|
||||
public synchronized String[] getLanguages()
|
||||
{
|
||||
if (m_languages == null)
|
||||
return null;
|
||||
|
@ -216,11 +218,11 @@ public final class Msg
|
|||
* @param language Language code
|
||||
* @return true, if language is loaded
|
||||
*/
|
||||
public boolean isLoaded (String language)
|
||||
public synchronized boolean isLoaded (String language)
|
||||
{
|
||||
if (m_languages == null)
|
||||
return false;
|
||||
return m_languages.containsKey(language);
|
||||
return m_languages.get(language) != null && !m_languages.get(language).isEmpty();
|
||||
} // isLoaded
|
||||
|
||||
/**
|
||||
|
|
|
@ -145,9 +145,9 @@ public class MWorkflow extends X_AD_Workflow
|
|||
|
||||
|
||||
/** Single Cache */
|
||||
private static CCache<String,MWorkflow> s_cache = new CCache<String,MWorkflow>(Table_Name, 20);
|
||||
private static CCache<String,MWorkflow> s_cache = new CCache<String,MWorkflow>(Table_Name, Table_Name+"|Language_Workflow", 20);
|
||||
/** Document Value Cache */
|
||||
private static CCache<String,MWorkflow[]> s_cacheDocValue = new CCache<String,MWorkflow[]> (Table_Name, Table_Name+"_Document_Value", 5);
|
||||
private static CCache<String,MWorkflow[]> s_cacheDocValue = new CCache<String,MWorkflow[]> (Table_Name, Table_Name+"|AD_Client_Table", 5);
|
||||
/** Static Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger (MWorkflow.class);
|
||||
|
||||
|
|
|
@ -1455,6 +1455,8 @@ public class AdempiereMonitor extends HttpServlet
|
|||
}
|
||||
for (CacheInfo ccache : instances)
|
||||
{
|
||||
if (ccache.getName().endsWith("|CCacheListener"))
|
||||
continue;
|
||||
line = new tr();
|
||||
line.addElement(new td().addElement(WebEnv.getCellContent(ccache.getName())));
|
||||
line.addElement(new td().addElement(WebEnv.getCellContent(ccache.getTableName())));
|
||||
|
|
|
@ -291,7 +291,7 @@ public final class AEnv
|
|||
CCache<Integer,GridWindowVO> cache = windowCache.get(sessionID);
|
||||
if (cache == null)
|
||||
{
|
||||
cache = new CCache<Integer, GridWindowVO>(I_AD_Window.Table_Name, 10);
|
||||
cache = new CCache<Integer, GridWindowVO>(I_AD_Window.Table_Name, I_AD_Window.Table_Name+"|GridWindowVO|Session", 10);
|
||||
windowCache.put(sessionID, cache);
|
||||
}
|
||||
cache.put(AD_Window_ID, mWindowVO);
|
||||
|
|
|
@ -901,7 +901,7 @@ ContextMenuListener, IZoomableEditor
|
|||
private WTableDirEditor editor;
|
||||
|
||||
protected CCacheListener(String tableName, WTableDirEditor editor) {
|
||||
super(tableName, tableName, 0, true);
|
||||
super(tableName, tableName+"|CCacheListener", 0, 0, true);
|
||||
this.editor = editor;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue