Mantis Bug Tracker

View Issue DetailsJump to Notes ] Wiki ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000058jquantlib[All Projects] testspublic2008-12-20 13:502009-11-01 00:14
ReporterRichard Gomes 
Assigned ToRichard Gomes 
PrioritynormalSeveritymajorReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version0.1.3Fixed in Version0.1.3 
Summary0000058: DefaultObservable causes failure in EuropeanOptionTest
DescriptionTrying to get rid of JCF implementation and substituting by fastutil implementation causes failure in EuropeanOptionTest.

The change done in DefaultObservable made this class NotThreadSafe, which is acceptable due to performance reasons.

At the moment, it's not clear what's the root cause of failure in EuropeanOptionTest and it's not clear what are the side effects of having DefaultObservable as a not thread safe thing.
Steps To Reproduce1. Open DefaultObservable.java
2. Uncomment the line
   this.observers = new ObjectArrayList<Observer>();
3. Comment out the line
   this.observers = new CopyOnWriteArrayList<Observer>();
4. Save DefaultObservable.java
5. Open EuropeanOptionTest.java
6. Run as JUnit test
Additional Information    public DefaultObservable(Observable observable) {
        // this.observers = new ObjectArrayList<Observer>(); // EuropeanOptionTest fails !!!
        this.observers = new CopyOnWriteArrayList<Observer>();
        
        if (observable == null)
            throw new NullPointerException("observable is null");
        this.observable = observable;
    }
TagsNo tags attached.
Attached Files

- Relationships
related to 0000041closedRichard Gomes org.jquantlib.pricingengines :: Replace by fastutil classes instead of JCF concrete class 

-  Notes
(0000019)
Anonymous (viewer)
2008-12-22 11:45

change org.jquantlib.quotes.Handle

line 100 from
    private Observable delegatedObservable = new WeakReferenceObservable(this);

to
    private Observable delegatedObservable = new DefaultObservable(this);

and the test will pass, if we use ArrayList, Vector or ObjectArrayList

No sure what the implications are or the the issue is with WeakReferenceObservable, but seems to be a clue to the problem
(0000020)
Anonymous (viewer)
2008-12-22 11:45

just added that note without logging in...
Gary Kennedy
(0000072)
Richard Gomes (manager)
2009-01-27 01:38

Could you please revisit this issue when you test American Options?
Or maybe we could kick it to v0.1.3.

I dont think we have enough code and enough test cases to be sure about how it behaves. What do you think?

Thanks
(0000179)
Gary Kennedy (developer)
2009-02-13 19:49

I dont know the impact of the change I suggest, WeakReferenceObservable->DefaultObservable

If we dont fix until next release, I think the only problem will be tests involving theta, the actual analytic pricing engines themselves would be OK.

reassign to Richard
(0000230)
Genady Grabarnik (developer)
2009-03-07 18:08
edited on: 2009-03-07 18:10

I added a few more classes to the implementation of the List to see what will be the impact. I tried ArrayList, LinkedList, and applied synchronization to them.
The ArrayList and the LinkedList give persistent error in the same tests. Synchronized versions of the ArrayList and the LinkedList (and ObjectArrayList) generate ConcurrentModificationException in the same tests and places. I will investigate it further.

(0000232)
Richard Gomes (manager)
2009-03-07 23:56

Let's kick to v0.1.3
Probably we will have more elements to analyze.
(0000604)
Richard Gomes (manager)
2009-11-01 00:14

Class Handle was rewritten.

I've changed Link to extend from WeakReferenceObservable, as it was the initial idea. I've executed out test suite 3 times and everything works fine. It's a good sign, in spite it does not mean it will always work fine.

Anyway, conceptually, the correct thing should be the WeakReference otherwise Observers will not be reclaimed by gc whilst Observables still keep strong references to them.

See:
http://weblogs.java.net/blog/enicholas/archive/2006/05/understanding_w.html [^]

- Issue History
Date Modified Username Field Change
2008-12-20 13:50 Richard Gomes New Issue
2008-12-20 13:50 Richard Gomes Status new => assigned
2008-12-20 13:50 Richard Gomes Assigned To => Gary Kennedy
2008-12-20 13:51 Richard Gomes Issue Monitored: Richard Gomes
2008-12-20 13:51 Richard Gomes Issue Monitored: Srinivas Hasti
2008-12-20 13:51 Richard Gomes Issue Monitored: Dominik Holenstein
2008-12-20 13:52 Richard Gomes Relationship added related to 0000041
2008-12-22 11:45 Anonymous Note Added: 0000019
2008-12-22 11:45 Anonymous Note Added: 0000020
2009-01-25 21:33 Richard Gomes Target Version => 0.1.2
2009-01-27 01:38 Richard Gomes Note Added: 0000072
2009-01-27 01:38 Richard Gomes Status assigned => feedback
2009-02-13 19:49 Gary Kennedy Note Added: 0000179
2009-02-13 19:50 Gary Kennedy Status feedback => assigned
2009-02-13 19:50 Gary Kennedy Assigned To Gary Kennedy => Richard Gomes
2009-03-07 18:00 Genady Grabarnik Issue Monitored: Genady Grabarnik
2009-03-07 18:08 Genady Grabarnik Note Added: 0000230
2009-03-07 18:10 Genady Grabarnik Note Edited: 0000230
2009-03-07 23:56 Richard Gomes Note Added: 0000232
2009-03-07 23:56 Richard Gomes Target Version 0.1.2 => 0.1.3
2009-11-01 00:07 Richard Gomes Issue Monitored: Gary Kennedy
2009-11-01 00:14 Richard Gomes Note Added: 0000604
2009-11-01 00:14 Richard Gomes Status assigned => resolved
2009-11-01 00:14 Richard Gomes Fixed in Version => 0.1.3
2009-11-01 00:14 Richard Gomes Resolution open => fixed


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker