DashboardPanel subclass should not cache Env Ctx

Description

The Ctx Cache is unnecessary and brings the following issue:

  • Increase memory usage

  • Interfere with CCache

Environment

None

Activity

Show:
Carlos Ruiz
May 19, 2020, 1:45 PM

Hi .

Reviewing the code, there are other classes defining an own context, like
MRelationType.parseWhereClause
WebEnv.initWeb
AdempiereMonitor.createLogMgtPage

Others to review, but maybe are valid:
AbstractProcessDialog.BackgroundJobRunnable
MSystem() constructor

And these (maybe the server is not up and because of that context cannot be used)?
AdempiereActivator.setupPackInContext
Incremental2PackActivator.setupPackInContext
PackInApplicationActivator.setupPackInContext
Version2PackActivator.setupPackInContext

Which would be a valid case to create a context, I guess maybe in Scheduler that we want to allow running with a tenant context instead of System.

Regards,

Carlos Ruiz

Heng Sin Low
May 19, 2020, 2:26 PM
Edited

Hi Carlos,

A background process, can define its own context but that should be through the ServerContext.setCurrentInstance(Properties) method, not by passing a plain Properties object around. After the setCurrentInstance call, Env.getCtx() should be use after that.

Regards,

Low

Heng Sin Low
May 20, 2020, 11:25 AM

The following needs fixing:

  • WebEnv.initWeb

  • AdempiereMonitor.createLogMgtPage

  • MSystem () - should be removed

MRelationType.parseWhereClause is fine as the context is only use for variable parsing and not for interaction with db or cache.

The rest is fine as it is using the ServerContext.setCurrentInstance approach.

Assignee

Heng Sin Low

Reporter

Heng Sin Low

Labels

Tested By

None

Components

Fix versions

Priority

Major
Configure