Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0040046Openbravo ERPA. Platformpublic2019-01-28 14:032019-03-28 14:55
caristu 
caristu 
highminorhave not tried
closedfixed 
5
 
3.0PR19Q2 
alostale
Core
No
0040046: unnecessary objects are created every time any DAL object is created/updated/deleted
EntityPersistenceEventObserver should be declared as an @ApplicationScoped bean, otherwise when a new event (save, update, delete, transaction begin, transaction completed) is fired a new instance of every EntityPersistenceEventObserver listening to that particular event is created.
1) Apply the provided patch, which writes in the log every time a new instance of EntityPersistenceEventObserver is created.
2) Go to the [Sales Order]
3) Create a new record. Check in the log that a new instance of every EntityPersistenceEventObserver listening to the save event is created.
4) Create another record. Check in the log that a new instance of every EntityPersistenceEventObserver listening to the save event is created again.

Note that same happens for the rest of events.
Set EntityPersistenceEventObserver as @ApplicationScoped and review all classes extending EntityPersistenceEventObserver to ensure that this change is safe.
Performance
related to defect 0030571 closed AugustoMauch Openbravo ERP It is not possible to remove a row if it contains a mandatory image 
related to defect 0040072 new Triage Omni WMS Modules TaskEventObserver should be defined as @ApplicationScoped 
related to defect 0040066 closed caristu Openbravo ERP API Change: EntityPersistenceEventObserver declared as an @ApplicationScoped bean 
related to defect 0040067 closed caristu Openbravo ERP Cleanup in EntityPersistenceEventObserver classes 
diff entityPersistenceEventObserver.diff (1,098) 2019-01-28 14:04
https://issues.openbravo.com/file_download.php?file_id=12557&type=bug
Issue History
2019-01-28 14:03caristuNew Issue
2019-01-28 14:03caristuAssigned To => platform
2019-01-28 14:03caristuModules => Core
2019-01-28 14:03caristuTriggers an Emergency Pack => No
2019-01-28 14:04caristuFile Added: entityPersistenceEventObserver.diff
2019-01-28 14:08caristuDescription Updatedbug_revision_view_page.php?rev_id=18196#r18196
2019-01-28 14:08caristuSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=18198#r18198
2019-01-28 14:08caristuAssigned Toplatform => caristu
2019-01-28 14:08caristuProposed Solution updated
2019-01-28 16:11caristuSummaryEntityPersistenceEventObserver should be declared as application scoped => EntityPersistenceEventObserver should be declared as @ApplicationScoped
2019-01-28 16:11caristuDescription Updatedbug_revision_view_page.php?rev_id=18199#r18199
2019-01-29 09:01alostaleTag Attached: Performance
2019-01-29 09:03alostaleSummaryEntityPersistenceEventObserver should be declared as @ApplicationScoped => unnecessary objects are created every time any DAL object is created/updated/deleted
2019-01-30 12:57caristuIssue cloned0040066
2019-01-30 12:57caristuRelationship addedrelated to 0040066
2019-01-30 13:02caristuIssue cloned0040067
2019-01-30 13:02caristuRelationship addedrelated to 0040067
2019-01-30 13:22caristuRelationship addedrelated to 0030571
2019-01-30 13:49hgbotCheckin
2019-01-30 13:49hgbotNote Added: 0109328
2019-01-30 13:52hgbotCheckin
2019-01-30 13:52hgbotNote Added: 0109329
2019-01-30 13:57hgbotCheckin
2019-01-30 13:57hgbotNote Added: 0109330
2019-01-30 14:05caristuRelationship addedrelated to 0040072
2019-01-30 19:07hgbotCheckin
2019-01-30 19:07hgbotNote Added: 0109339
2019-01-30 19:09caristuStatusnew => scheduled
2019-02-01 09:49hgbotCheckin
2019-02-01 09:49hgbotNote Added: 0109408
2019-02-01 09:49hgbotStatusscheduled => resolved
2019-02-01 09:49hgbotResolutionopen => fixed
2019-02-01 09:49hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/396b375afe225c3474e022655cd11040e73f2734 [^]
2019-02-01 09:50caristuReview Assigned To => alostale
2019-02-11 14:39alostaleNote Added: 0109671
2019-02-11 14:39alostaleStatusresolved => closed
2019-02-11 14:39alostaleFixed in Version => 3.0PR19Q2
2019-03-28 14:55hudsonbotCheckin
2019-03-28 14:55hudsonbotNote Added: 0110761
2019-03-28 14:55hudsonbotCheckin
2019-03-28 14:55hudsonbotNote Added: 0110787

Notes
(0109328)
hgbot   
2019-01-30 13:49   
Repository: erp/devel/pi
Changeset: e74dadb5ea9bc8b31f9625d86473b91cdb61542c
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed Jan 30 13:48:11 2019 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/e74dadb5ea9bc8b31f9625d86473b91cdb61542c [^]

related to issue 40046: make observer be stateless

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/event/RemoveImagesEventHandler.java
---
(0109329)
hgbot   
2019-01-30 13:52   
Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 26fa6e6dce880dfd4227590b86abd9419b92aab1
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed Jan 30 13:50:52 2019 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/26fa6e6dce880dfd4227590b86abd9419b92aab1 [^]

related to issue 40046: make observer be stateless

---
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/ImportEntryNoSyncEventHandler.java
---
(0109330)
hgbot   
2019-01-30 13:57   
Repository: erp/pmods/org.openbravo.warehouse.advancedwarehouseoperations
Changeset: 40f8f26b154025a40f30aca8c7a6588dd6431739
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed Jan 30 13:55:53 2019 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.warehouse.advancedwarehouseoperations/rev/40f8f26b154025a40f30aca8c7a6588dd6431739 [^]

related to issue 40046: define observer as Dependent

  - Explicitly define the observer as @Dependent
  - Applied new java formatting

---
M src/org/openbravo/warehouse/advancedwarehouseoperations/eventobserver/TaskEventObserver.java
---
(0109339)
hgbot   
2019-01-30 19:07   
Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 2d93921155ac5011d455f3d44ea27b043cf199df
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed Jan 30 19:03:22 2019 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/2d93921155ac5011d455f3d44ea27b043cf199df [^]

related to issue 40046: remove final modifiers to avoid error on server startup

  Removed the final modifiers, now that the observers are @ApplicationScoped, the following error is raised on server startup in case they are final or if they have any final method: "org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001437 Normal scoped bean class is not proxyable because the type is final or it contains a final method"

---
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/AutoRouteAndPushGenericEventHandler.java
---
(0109408)
hgbot   
2019-02-01 09:49   
Repository: erp/devel/pi
Changeset: 396b375afe225c3474e022655cd11040e73f2734
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Fri Feb 01 08:48:40 2019 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/396b375afe225c3474e022655cd11040e73f2734 [^]

fixes bug 40046: unnecessary objects created every time a DAL event is fired

  Declare EntityPersistenceEventObserver as @ApplicationScoped so that just one instance of every event handler is created by default. This is because being Dependent, a new instance of every event handler listening to a particular DAL event (save, update, delete, transaction begin, transaction completed) was being created.

---
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/event/EntityPersistenceEventObserver.java
---
(0109671)
alostale   
2019-02-11 14:39   
reviewed
(0110761)
hudsonbot   
2019-03-28 14:55   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/b2fbc1588df4 [^]
Maturity status: Test
(0110787)
hudsonbot   
2019-03-28 14:55   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/b2fbc1588df4 [^]
Maturity status: Test