IDEMPIERE-4330 New tables are not logged - requires a server restart (#111)

* IDEMPIERE-4330 New tables are not logged - requires a server restart

* IDEMPIERE-4330 New tables are not logged - requires a server restart

Add synchronized to isLogged and resetLoggedList as advised by Heng Sin
This commit is contained in:
Carlos Ruiz 2020-06-13 15:37:04 +02:00 committed by GitHub
parent 5adad12309
commit aac7d81077
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -37,15 +37,14 @@ public class MChangeLog extends X_AD_ChangeLog
/** /**
* *
*/ */
private static final long serialVersionUID = -7156972859181201446L; private static final long serialVersionUID = 7262833610411402160L;
/** /**
* Do we track changes for this table * Do we track changes for this table
* @param AD_Table_ID table * @param AD_Table_ID table
* @return true if changes are tracked * @return true if changes are tracked
*/ */
public static boolean isLogged (int AD_Table_ID) public static synchronized boolean isLogged (int AD_Table_ID)
{ {
if (s_changeLog == null || s_changeLog.length == 0) if (s_changeLog == null || s_changeLog.length == 0)
fillChangeLog(); fillChangeLog();
@ -53,6 +52,10 @@ public class MChangeLog extends X_AD_ChangeLog
int index = Arrays.binarySearch(s_changeLog, AD_Table_ID); int index = Arrays.binarySearch(s_changeLog, AD_Table_ID);
return index >= 0; return index >= 0;
} // trackChanges } // trackChanges
public static synchronized void resetLoggedList() {
s_changeLog = null;
}
/** /**
* Fill Log with tables to be logged * Fill Log with tables to be logged

View File

@ -498,6 +498,12 @@ public class MColumn extends X_AD_Column
} }
*/ */
if ((newRecord || is_ValueChanged(COLUMNNAME_ColumnName))
&& ( "EntityType".equals(getColumnName())
|| "EntityType".equals(get_ValueOld(COLUMNNAME_ColumnName).toString()))) {
MChangeLog.resetLoggedList();
}
return success; return success;
} // afterSave } // afterSave

View File

@ -568,6 +568,9 @@ public class MTable extends X_AD_Table
seq.setName(getTableName()); seq.setName(getTableName());
seq.saveEx(); seq.saveEx();
} }
if (newRecord || is_ValueChanged(COLUMNNAME_IsChangeLog)) {
MChangeLog.resetLoggedList();
}
return success; return success;
} // afterSave } // afterSave