IDEMPIERE-455 Discover and fix FindBugs problems / Patterns Multithreaded correctness

This commit is contained in:
Carlos Ruiz 2012-12-17 20:32:05 -05:00
parent 7516e37f1f
commit d3e8ef0a7a
39 changed files with 50 additions and 50 deletions

View File

@ -66,7 +66,7 @@ public class DocManager {
return documentsTableName;
}
private static void fillDocumentsTableArrays() {
private synchronized static void fillDocumentsTableArrays() {
if (documentsTableID == null) {
String sql = "SELECT t.AD_Table_ID, t.TableName " +
"FROM AD_Table t, AD_Column c " +

View File

@ -48,7 +48,7 @@ public class CConnection implements Serializable, Cloneable
*/
private static final long serialVersionUID = -7893119456331485444L;
/** Connection */
private static CConnection s_cc = null;
private volatile static CConnection s_cc = null;
/** Logger */
private static CLogger log = CLogger.getCLogger (CConnection.class);
@ -86,7 +86,7 @@ public class CConnection implements Serializable, Cloneable
* @param apps_host optional apps host for new connections
* @return Connection Descriptor
*/
public static CConnection get (String apps_host)
public synchronized static CConnection get (String apps_host)
{
if (s_cc == null)
{
@ -1418,7 +1418,7 @@ public class CConnection implements Serializable, Cloneable
* Get Last Exception of Apps Server Connection attempt
* @return Exception or null
*/
public Exception getAppsServerException ()
public synchronized Exception getAppsServerException ()
{
return m_appsException;
} // getAppsServerException

View File

@ -432,7 +432,7 @@ public abstract class Convert
*/
public abstract boolean isOracle();
public static void logMigrationScript(String oraStatement, String pgStatement) {
public synchronized static void logMigrationScript(String oraStatement, String pgStatement) {
// Check AdempiereSys
// check property Log migration script
boolean logMigrationScript = false;

View File

@ -51,7 +51,7 @@ public class MEXPProcessor extends X_EXP_Processor {
/** Static Logger */
private static CLogger s_log = CLogger.getCLogger (MEXPProcessor.class);
private static MEXPProcessor processor= null;
private volatile static MEXPProcessor processor= null;
private X_EXP_ProcessorParameter[] parameters = null;
public static MEXPProcessor get(Properties ctx, int EXP_Processor_ID, String trxName)

View File

@ -186,7 +186,7 @@ public class MLocator extends X_M_Locator
} // get
/** Cache */
private static CCache<Integer,MLocator> s_cache;
private volatile static CCache<Integer,MLocator> s_cache;
/** Logger */
private static CLogger s_log = CLogger.getCLogger (MLocator.class);

View File

@ -196,7 +196,7 @@ public class MRequestType extends X_R_RequestType
* Get Total No of requests of type
* @return no
*/
public int getTotalNo()
public synchronized int getTotalNo()
{
updateStatistics();
return m_totalNo;
@ -206,7 +206,7 @@ public class MRequestType extends X_R_RequestType
* Get Open No of requests of type
* @return no
*/
public int getOpenNo()
public synchronized int getOpenNo()
{
updateStatistics();
return m_openNo;
@ -216,7 +216,7 @@ public class MRequestType extends X_R_RequestType
* Get Closed in last 30 days of type
* @return no
*/
public int getClosed30No()
public synchronized int getClosed30No()
{
updateStatistics();
return m_closed30No;
@ -226,7 +226,7 @@ public class MRequestType extends X_R_RequestType
* Get New in the last 30 days of type
* @return no
*/
public int getNew30No()
public synchronized int getNew30No()
{
updateStatistics();
return m_new30No;

View File

@ -62,7 +62,7 @@ public class MSystem extends X_AD_System
* @param ctx context
* @return System
*/
public static MSystem get (Properties ctx)
public synchronized static MSystem get (Properties ctx)
{
if (s_system != null)
return s_system;

View File

@ -35,7 +35,7 @@ public class MUserDefWin extends X_AD_UserDef_Win
*/
private static final long serialVersionUID = -5775251886672840324L;
private static List<MUserDefWin> m_fullList = null;
private volatile static List<MUserDefWin> m_fullList = null;
/**
* Standard constructor.

View File

@ -65,7 +65,7 @@ public class TranslationTable
* @param requery requery
* @return number of active Translations
*/
public static int getActiveLanguages (boolean requery)
public synchronized static int getActiveLanguages (boolean requery)
{
if (s_activeLanguages != null && !requery)
return s_activeLanguages.intValue();

View File

@ -195,7 +195,7 @@ public class ArchiveEngine
/** Logger */
private static CLogger log = CLogger.getCLogger(ArchiveEngine.class);
/** Singleton */
private static ArchiveEngine s_engine = null;
private volatile static ArchiveEngine s_engine = null;
/**************************************************************************

View File

@ -171,7 +171,7 @@ public class SwapFile
freeBlocks(segment.getOffsets());
}
private void verifyOpen() {
private synchronized void verifyOpen() {
if (randomAccessFile == null) {
throw new RuntimeException("Swap file not open for read write access");
}

View File

@ -52,7 +52,7 @@ public class CCachedRowSet extends CachedRowSetImpl implements CachedRowSet
* @return Cached Row Set
* @throws SQLException
*/
public static CCachedRowSet get() throws SQLException
public synchronized static CCachedRowSet get() throws SQLException
{
CCachedRowSet crs = null;
// only first time call

View File

@ -116,7 +116,7 @@ public class CLogger extends Logger implements Serializable
} // get
/** Default Logger */
private static CLogger s_logger = null;
private volatile static CLogger s_logger = null;
/**************************************************************************

View File

@ -255,7 +255,7 @@ public final class DB
* Set connection
* @param cc connection
*/
public static void setDBTarget (CConnection cc)
public synchronized static void setDBTarget (CConnection cc)
{
if (cc == null)
throw new IllegalArgumentException("Connection is NULL");

View File

@ -224,7 +224,7 @@ public final class Ini implements Serializable
};
/** Container for Properties */
private static Properties s_prop = new Properties();
private volatile static Properties s_prop = new Properties();
private static String s_propertyFileName = null;

View File

@ -217,7 +217,7 @@ public class SecureEngine
/** Test String */
private static final String TEST = "This is a 0123456789 .,; -= Test!";
/** Secure Engine */
private static SecureEngine s_engine = null;
private volatile static SecureEngine s_engine = null;
/** The real Engine */
private SecureInterface implementation = null;

View File

@ -64,7 +64,7 @@ public class WebInfo
} // getGeneral
/** General Info */
private static WebInfo m_general = null;
private volatile static WebInfo m_general = null;
/**
* Constructor

View File

@ -107,7 +107,7 @@ public class WebUser
} // get
/** Short term Cache for immediate re-query/post (hit rate 20%) */
private static WebUser s_cache = null;
private volatile static WebUser s_cache = null;
/*************************************************************************/

View File

@ -55,7 +55,7 @@ public class DocWorkflowManager implements DocWorkflowMgr
}
/** Document Workflow Manager */
private static DocWorkflowManager s_mgr = null;
private volatile static DocWorkflowManager s_mgr = null;
/** Logger */
private static CLogger log = CLogger.getCLogger(DocWorkflowManager.class);

View File

@ -50,7 +50,7 @@ public class HttpServiceImpl implements HttpService, ExtendedHttpService {
shutdown = true;
}
private void checkShutdown() {
private synchronized void checkShutdown() {
if (shutdown)
throw new IllegalStateException("Service instance is already shutdown"); //$NON-NLS-1$
}

View File

@ -42,7 +42,7 @@ public class ProxyServlet extends HttpServlet implements Filter {
Activator.addProxyServlet(this);
}
public void destroy() {
public synchronized void destroy() {
Activator.removeProxyServlet(this);
proxyContext.destroy();
proxyContext = null;
@ -56,7 +56,7 @@ public class ProxyServlet extends HttpServlet implements Filter {
process(req, resp, null);
}
protected void process(HttpServletRequest req, HttpServletResponse resp, FilterChain filterChain) throws ServletException, IOException {
protected synchronized void process(HttpServletRequest req, HttpServletResponse resp, FilterChain filterChain) throws ServletException, IOException {
proxyContext.initializeServletPath(req, filterChain);
String alias = HttpServletRequestAdaptor.getDispatchPathInfo(req, filterChain);
if (alias == null)

View File

@ -35,7 +35,7 @@ public class BridgeServlet extends HttpServlet {
private static HttpServlet servletDelegateInstance;
private HttpServlet delegate;
// true if current HttpServlet is an HTTP Filter and false otherwise.
private boolean delegateIsFilter;
private static boolean delegateIsFilter;
private int delegateReferenceCount;
/**
@ -175,7 +175,7 @@ public class BridgeServlet extends HttpServlet {
try {
// cache the flag if HttpServlet servlet delegate is an HTTP Filter.
instance.delegateIsFilter = (servletDelegate instanceof Filter);
BridgeServlet.delegateIsFilter = (servletDelegate instanceof Filter);
// initialize the servlet delegate.
servletDelegate.init(instance.getServletConfig());
} catch (ServletException e) {
@ -207,7 +207,7 @@ public class BridgeServlet extends HttpServlet {
HttpServlet oldProxy = instance.delegate;
instance.delegate = null;
instance.delegateIsFilter = false;
BridgeServlet.delegateIsFilter = false;
while (instance.delegateReferenceCount != 0) {
try {
instance.wait();

View File

@ -38,7 +38,7 @@ public class AdempiereServerGroup extends ThreadGroup
} // get
/** Group */
private static AdempiereServerGroup s_group = null;
private volatile static AdempiereServerGroup s_group = null;
/**
* AdempiereServerGroup

View File

@ -94,11 +94,11 @@ public class AdempiereMonitor extends HttpServlet
/** Logger */
private static CLogger log = CLogger.getCLogger(AdempiereMonitor.class);
/** The Server */
private AdempiereServerMgr m_serverMgr = null;
private static AdempiereServerMgr m_serverMgr = null;
/** Message */
private p m_message = null;
private static p m_message = null;
private ArrayList<File> m_dirAccessList = null;
private volatile static ArrayList<File> m_dirAccessList = null;
/**
* Get

View File

@ -146,7 +146,7 @@ public final class VAccountDialog extends CDialog
protected boolean m_changed = false;
/** Accounting Schema */
private static MAcctSchema s_AcctSchema = null;
private volatile static MAcctSchema s_AcctSchema = null;
/** MWindow for AccountCombination */
private GridWindow m_mWindow = null;
/** MTab for AccountCombination */

View File

@ -90,7 +90,7 @@ public class AtmosphereServerPush implements ServerPush {
synchronized (info) {
info.nActive = 1; //granted
info.notify();
info.notifyAll();
}
try {
@ -145,7 +145,7 @@ public class AtmosphereServerPush implements ServerPush {
_active = null;
synchronized (_mutex) {
_mutex.notify();
_mutex.notifyAll();
}
}
}

View File

@ -123,7 +123,7 @@ public final class WAccountDialog extends Window
protected boolean m_changed = false;
/** Accounting Schema */
private static MAcctSchema s_AcctSchema = null;
private volatile static MAcctSchema s_AcctSchema = null;
/** MWindow for AccountCombination */
private GridWindow m_mWindow = null;
/** MTab for AccountCombination */

View File

@ -43,7 +43,7 @@ import org.compiere.util.WebEnv;
public class StoreFilter implements javax.servlet.Filter
{
/** Logging */
private static CLogger log = null;
private volatile static CLogger log = null;
/**
* Init

View File

@ -164,7 +164,7 @@ public class DB_Oracle implements AdempiereDatabase
* @return Driver
* @throws SQLException
*/
public Driver getDriver() throws SQLException
public synchronized Driver getDriver() throws SQLException
{
if (s_driver == null)
{

View File

@ -45,7 +45,7 @@ import fitnesse.fixtures.TableFixture;
* @author Carlos Ruiz - globalqss
*/
public class AssertRecord extends TableFixture {
private static Instance adempiereInstance = null;
private volatile static Instance adempiereInstance = null;
@Override
protected void doStaticTable(int rows) {

View File

@ -36,7 +36,7 @@ import fitnesse.fixtures.TableFixture;
* @author Carlos Ruiz - globalqss
*/
public class AssertVariable extends TableFixture {
private static Instance adempiereInstance = null;
private volatile static Instance adempiereInstance = null;
@Override
protected void doStaticTable(int rows) {

View File

@ -44,7 +44,7 @@ import fitnesse.fixtures.TableFixture;
* @author Carlos Ruiz - globalqss
*/
public class CreateRecord extends TableFixture {
private static Instance adempiereInstance = null;
private volatile static Instance adempiereInstance = null;
@Override
protected void doStaticTable(int rows) {

View File

@ -39,7 +39,7 @@ import fitnesse.fixtures.TableFixture;
*/
public class Login extends TableFixture {
private static final String LANGUAGE_EN_US = "en_US";
private static Instance adempiereInstance = null;
private volatile static Instance adempiereInstance = null;
private String m_user;
private String m_password;
private String m_language;

View File

@ -45,7 +45,7 @@ import fitnesse.fixtures.TableFixture;
* @author Carlos Ruiz - globalqss
*/
public class ReadRecord extends TableFixture {
private static Instance adempiereInstance = null;
private volatile static Instance adempiereInstance = null;
@Override
protected void doStaticTable(int rows) {

View File

@ -58,7 +58,7 @@ import fitnesse.fixtures.TableFixture;
* @author Carlos Ruiz - globalqss
*/
public class RunProcess extends TableFixture {
private static Instance adempiereInstance = null;
private volatile static Instance adempiereInstance = null;
private static CLogger log = CLogger.getCLogger(RunProcess.class);

View File

@ -43,7 +43,7 @@ import fitnesse.fixtures.TableFixture;
* @author Carlos Ruiz - globalqss
*/
public class SetDocAction extends TableFixture {
private static Instance adempiereInstance = null;
private volatile static Instance adempiereInstance = null;
@Override
protected void doStaticTable(int rows) {

View File

@ -38,7 +38,7 @@ import fitnesse.fixtures.TableFixture;
* @author Carlos Ruiz - globalqss
*/
public class SetVariable extends TableFixture {
private static Instance adempiereInstance = null;
private volatile static Instance adempiereInstance = null;
@Override
protected void doStaticTable(int rows) {

View File

@ -32,7 +32,7 @@ package org.idempiere.fitnesse.fixture;
* @author Carlos Ruiz - globalqss
*/
public class Static_iDempiereInstance {
private static Instance adempiereInstance;
private volatile static Instance adempiereInstance;
public static Instance getInstance() {
if (adempiereInstance == null) {

View File

@ -39,7 +39,7 @@ public class Activator implements BundleActivator {
return context;
}
private static HazelcastInstance hazelcastInstance;
private volatile static HazelcastInstance hazelcastInstance;
private static AtomicReference<Future<?>> futureRef = new AtomicReference<Future<?>>();
/*