Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 248997

Summary: Protect closed sessions and their views against illegal usage
Product: [Modeling] EMF Reporter: Eike Stepper <stepper>
Component: cdo.coreAssignee: Eike Stepper <stepper>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: adietish, mtaal, smcduff
Version: 2.0Flags: stepper: galileo+
Target Milestone: M3   
Hardware: All   
OS: All   
Whiteboard: Lighter, Faster and Better

Description Eike Stepper CLA 2008-09-29 14:23:50 EDT
When a CDOSession is closed neither the session nor one of its views must be used anymore.  Add checks and throw proper exceptions if violated.
Comment 1 Eike Stepper CLA 2008-09-29 14:45:51 EDT
Hmm, the more I think about it the more concerns about performance arise: Even if we protect each API method of CDOSession, CDOView, CDOTransaction and CDOAUdit, what would happen with CDOObject itself??

Should we really protect each method on CDOStore like this?
Simon, what do you think?
Comment 2 Martin Taal CLA 2008-09-29 15:47:17 EDT
In my view checking for a closed session is the nicest approach (so protect each method). I don't know cdo that well but maybe there is somewhere in the lower layers where this can be checked.
Or the otherway around if a session gets closed then maybe it can set a flag in the related objects (transaction, etc. and maybe even cdoobject) that the underlying session is closed. Then the performance for checking it not that large (only check a local flag).

gr. Martin
Comment 3 Simon Mc Duff CLA 2008-09-30 10:14:51 EDT
(In reply to comment #1)
> Hmm, the more I think about it the more concerns about performance arise: Even
> if we protect each API method of CDOSession, CDOView, CDOTransaction and
> CDOAUdit, what would happen with CDOObject itself??
> 
> Should we really protect each method on CDOStore like this?
> Simon, what do you think?
> 

If we put a check for each API method of CDOSession and CDOView etc...
CDOStore would use the one in CDOView.. right ?

I don't like the approach of flagging every objects to tell them they are invalid.

I would say that we should simply uses a strategy for CDOSession and CDOView.
CDOStore should access the strategy using CDOView. It should be fast enough.

Right ?


Comment 4 Eike Stepper CLA 2008-09-30 12:32:08 EDT
I completely agree!

Reminder for me: 
Add CDOSession.isClosed() and CDOView.isClosed()
Maybe in common...
Comment 5 Eike Stepper CLA 2008-09-30 14:49:45 EDT
I added the following API:

- CDOProtocolSession.close()
- CDOProtocolSession.isClosed()
- CDOProtocolView.isClosed()

Then I added checks in:

- CDOSessionImpl, Session
- CDOViewImpl, View
- CDOTransactionImpl, Transaction
- CDOAudit, Audit
- FSMUtil.adapt() to catch all object access

Committed to HEAD.
Comment 6 Eike Stepper CLA 2008-10-09 16:16:51 EDT
Fix available in CDO 2.0.0 I200810091534
Comment 7 Eike Stepper CLA 2009-06-27 11:53:17 EDT
Generally available.