Project

General

Profile

bug #7046

replace open session per view pattern by DTO strategy

Added by Andreas Kohlbecker about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Highest
Category:
cdm-vaadin
Target version:
Start date:
11/02/2017
Due date:
% Done:

40%

Severity:
critical
Found in Version:

Description

In #6687 the open session per view pattern has been implemented for the cdm-vaadin mvp framework.

It turned out that this approach is causing problems since a session opened in one view needs to be reused in multiple request threads. In order to accomplish this it is always required to have a transaction open for the whole lifetime of the view which causes an open database connection for the same time. The database connection pool is limited to a maximum amount of open connections and can thus run out of available connections when too many views are opened at the same time. This situation is becoming worse if vaadin views are not destroyed fast enough so that the resource are being freed quickly (#7047).

As explained in VaadinNotes the best way to avoid LazyInitializytionExceptions is to use DTOs or entity bean initialization strategies. This will not only allow to free database connections as quickly as possible but also avoids managing long transactions logs at in the database itself.

TODO:

  • remove all open session per view pattern code
  • use bean init-strategies to avoid LazyInitializytionExceptions
  • in order to save edited entities, open a new clean session, merge the modified entity and flush and commit
    • In future we may want to check for intermediate modifications of the entity by other users. I case a modification by someone else is detected the application will present a dialog to inform the user that someone else work will be overwritten. The dialog should present a table of all conflicting properties allowing the user to resolve the conflict. #7050

Related issues

Related to Edit - bug #6687: Multiple representations of the same entity merge problem Closed 06/02/2017
Related to Edit - bug #7047: Vaadin UI and View scope beans are not always destroyed correctly Closed 11/02/2017
Related to Edit - bug #7036: correctly release vaadin view resources when the browser windows has been closed Closed 10/25/2017

Associated revisions

Revision 2f02081c (diff)
Added by Andreas Kohlbecker about 1 year ago

ref #7046 completely removing open session per view implementation and adding init strategies for Name and Typedesignation editor

Revision daf5d5b4 (diff)
Added by Andreas Kohlbecker about 1 year ago

ref #7046 removing request start and end listener classes

Revision d6bdb890 (diff)
Added by Andreas Kohlbecker about 1 year ago

ref #7046 removing prepareAsFieldGroupDataSource() which was opening connectinos which where never closed and adding missing initStrategies

Revision c986e218 (diff)
Added by Andreas Kohlbecker about 1 year ago

ref #7046 load by id method in service base class

Revision 02ec8d6b (diff)
Added by Andreas Kohlbecker about 1 year ago

ref #7059 ref #7046 using kindOfunit for TypeDesisgnations instead of DerivationEvent type and fixing save and LIE problems:
- intoducing EntityCache to allow re-using previously loaded entities
- CdmEntityCache implements EntityCache
- ToOneRelatedEntityReloader to replace entities loaded by the LazySelect
- SpecimenTypeDesignationWorkingsetEditorPresenter implements CachingPresenter so that EnityCache and
ToOneRelatedEntityReloader can interact
- completing init strategies in RegistrationWorkingSetService
- SpecimenTypeDesignationWorkingsetEditorPresenter.saveBean reuses entities stored in entityCache
- introducing SpecimenTypeDesignationWorkingSetService

History

#1 Updated by Andreas Kohlbecker about 1 year ago

  • Description updated (diff)

#2 Updated by Andreas Kohlbecker about 1 year ago

  • Related to bug #6687: Multiple representations of the same entity merge problem added

#3 Updated by Andreas Kohlbecker about 1 year ago

  • Description updated (diff)

#4 Updated by Andreas Kohlbecker about 1 year ago

  • Related to bug #7047: Vaadin UI and View scope beans are not always destroyed correctly added

#5 Updated by Andreas Kohlbecker about 1 year ago

  • Related to bug #7036: correctly release vaadin view resources when the browser windows has been closed added

#6 Updated by Andreas Kohlbecker about 1 year ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 40

#7 Updated by Andreas Kohlbecker about 1 year ago

  • Description updated (diff)
  • Status changed from In Progress to Resolved
  • Assignee changed from Andreas Kohlbecker to Fabian Reimeier

@Fabian: The refactoring is completed now. can you please do an in depth check on the distribution editor to confirm that nothing has been broke by these commits? All changes are in a feature branch which will be merged to develop once we know that there are no problems.

#8 Updated by Andreas Kohlbecker about 1 year ago

Andreas Kohlbecker wrote:

@Fabian: The refactoring is completed now. can you please do an in depth check on the distribution editor to confirm that nothing has been broke by these commits? All changes are in a feature branch which will be merged to develop once we know that there are no problems.

I fixed some remaining problems and did a fast forward merge of the feature branch into develop. So you can test on develop directly.

#9 Updated by Andreas Müller about 1 year ago

I have tested the distribution app intensively and couldn't find an problem, especially no LIE. Even after logout and login again. So maybe we can close this ticket.

#10 Updated by Andreas Kohlbecker about 1 year ago

  • Status changed from Resolved to Closed
  • Assignee changed from Fabian Reimeier to Andreas Kohlbecker

Great thank you for this confirmation, i also could not produce any error. So i am closing this ticket now.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)