Re: [Graph] Test problems after last commit

2012-03-04 Thread Simone Tripodi
Hi Marco! > just for summarize a little our discussion: currently the implementation > committed works exactly as  Collections.syncronized* methodos. si señor! > The workaround to export the lock outside is this: > > === > GraphInvocationHandler handler =   new GraphInvocationHandler( > synchr

Re: [Graph] Test problems after last commit

2012-03-04 Thread Marco Speranza
Ciao Simo, just for summarize a little our discussion: currently the implementation committed works exactly as Collections.syncronized* methodos. The workaround to export the lock outside is this: === GraphInvocationHandler handler = new GraphInvocationHandler( synchronizedMethods, checkedTo

Re: [Graph] Test problems after last commit

2012-03-03 Thread Simone Tripodi
Hi again Marco, I though once again on this and maybe having a synchronized Graph would be different than having a ConcurrentGraph, like Collections.synchronizedMap() and ConcurrentHashMap, so my suggestion is keeping the synchronized proxy as they are AND provide Concurrent* version of actual gra

Re: [Graph] Test problems after last commit

2012-03-03 Thread Simone Tripodi
Hi Marco, yes I know it, what doesn't convince me is not the problem, but the solution. Have a look at Collections.* source code to see how this problem is fixed in synchronizedMap. Anyway that confirms that maybe proxies are not the best to handle that situation - unless James has a solution (h

Re: [Graph] Test problems after last commit

2012-03-03 Thread James Carman
it would allow thread safety without synchronizing readers On Mar 3, 2012 9:34 AM, "Marco Speranza" wrote: > Ciao > sorry I didn't understand very well. How could help a read/write lock? > bye > > -- > Marco Speranza > > Flickr: http://www.flickr.com/photos/marcosperanza79/ > Google Code: http:/

Re: [Graph] Test problems after last commit

2012-03-03 Thread Marco Speranza
Ciao sorry I didn't understand very well. How could help a read/write lock? bye -- Marco Speranza Flickr: http://www.flickr.com/photos/marcosperanza79/ Google Code: http://code.google.com/u/marco.speranza79/ Il giorno 03/mar/2012, alle ore 14:40, James Carman ha scritto: > I think a read/wr

Re: [Graph] Test problems after last commit

2012-03-03 Thread Marco Speranza
Ciao > rue, but *all* methods executions (synchronized and not) are > performed inside the handler, contained in the proxy instance anyway. > > So an user cannot use the same "lock" in order to synchronize a block > like this: Let's give you an example. here is our handler implementation, and

Re: [Graph] Test problems after last commit

2012-03-03 Thread James Carman
I think a read/write lock might help. Reads only need to be synchronized around writes. They don't have to be synchronized with one another. On Mar 3, 2012 8:35 AM, "Simone Tripodi" wrote: > Hola Marco, > > > my doubt is this: opening a synchronized block into handler > implementation on 'this

Re: [Graph] Test problems after last commit

2012-03-03 Thread Simone Tripodi
Hola Marco, > my doubt is this:  opening a synchronized block into handler implementation > on 'this',  in my opinion is not enough, because the method > "CommonsGraph.synchronize()" returns a instance of the Proxy and not an > instance of handler. true, but *all* methods executions (synchroni

Re: [Graph] Test problems after last commit

2012-03-03 Thread Marco Speranza
Morning Simo, my doubt is this: opening a synchronized block into handler implementation on 'this', in my opinion is not enough, because the method "CommonsGraph.synchronize()" returns a instance of the Proxy and not an instance of handler. So an user cannot use the same "lock" in order to s

Re: [Graph] Test problems after last commit

2012-03-03 Thread Simone Tripodi
Good morning Marco, I had the chance to have a deeper look at your yesterday's night work and think your additions are good improvements - I just wonder if we can replace the lock object with the handler itself, referencing `this` instead. Thoughts? best and have a nice WE, -Simo http://people.

Re: [Graph] Test problems after last commit

2012-03-02 Thread Simone Tripodi
I saw the commit, please read comments inline. best, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Sat, Mar 3, 2012 at 1:40 AM, Marco Speranza wrote: > Hi I fixed the problem using proxy/handler.

Re: [Graph] Test problems after last commit

2012-03-02 Thread Marco Speranza
Hi I fixed the problem using proxy/handler. I put also a couple of tests. For do that I insert a test scoped dependency to a library net.sourceforge.groboutils.groboutils-core Ciao -- Marco Speranza Google Code: http://code.google.com/u/marco.speranza79/ Il giorno 03/mar/2012, alle ore 01:29,

Re: [Graph] Test problems after last commit

2012-03-02 Thread Simone Tripodi
yes, what I didn't understand is how you would like to manage the iterators issue sorry for the brevity but tonight I am getting crazy with at least 3 other projects :D -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://ww

Re: [Graph] Test problems after last commit

2012-03-02 Thread James Carman
Try commons proxy! Sent from tablet device. Please excuse typos and brevity. On Mar 2, 2012 7:01 PM, "Marco Speranza" wrote: > >> > >> furthermore there is another problem: with handler is not possible to > use correctly synchronization block like this > >> > >> > >> Graph g = CommonsGraph

Re: [Graph] Test problems after last commit

2012-03-02 Thread Marco Speranza
I think that we have to use the same patter of java Collections: a wrapper of Graph/MutableGraph that use a synchronize block. WDYT? -- Marco Speranza Google Code: http://code.google.com/u/marco.speranza79/ Il giorno 03/mar/2012, alle ore 01:10, Simone Tripodi ha scritto: > OK now sounds bett

Re: [Graph] Test problems after last commit

2012-03-02 Thread Simone Tripodi
OK now sounds better, thanks - how would you intend to fix it? TIA, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Sat, Mar 3, 2012 at 1:01 AM, Marco Speranza wrote: >>> >>> furthermore there is an

Re: [Graph] Test problems after last commit

2012-03-02 Thread Marco Speranza
>> >> furthermore there is another problem: with handler is not possible to use >> correctly synchronization block like this >> >> >> Graph g = CommonsGraph.synchronize(g_); >> ... >> synchronized(g) { >> for ( BaseLabeledVertex v2 : g.getVertices() ) >> { >> // d

Re: [Graph] Test problems after last commit

2012-03-02 Thread Simone Tripodi
> furthermore there is another problem: with handler is not possible to use > correctly synchronization block like this > > > Graph g = CommonsGraph.synchronize(g_); >     ... >  synchronized(g) { >       for ( BaseLabeledVertex v2 : g.getVertices() ) >       { >           // do somethings >

Re: [Graph] Test problems after last commit

2012-03-02 Thread Marco Speranza
> uhm I am not really satisfied, the checks and the proxy handler > decrease performances, that is why I asked you to improve the impl - > just implementing synchronized wrappers would be more performant, but > would make boring maintaining all data structures in synch with future > modifications..

Re: [Graph] Test problems after last commit

2012-03-02 Thread Simone Tripodi
uhm I am not really satisfied, the checks and the proxy handler decrease performances, that is why I asked you to improve the impl - just implementing synchronized wrappers would be more performant, but would make boring maintaining all data structures in synch with future modifications... best, -

Re: [Graph] Test problems after last commit

2012-03-02 Thread Marco Speranza
Om perfect simo... I just checked it out.. great work. :-) -- Marco Speranza Google Code: http://code.google.com/u/marco.speranza79/ Il giorno 02/mar/2012, alle ore 22:36, Simone Tripodi ha scritto: > I would have preferred a Concurrent* version for our data structures, > but I can happily li

Re: [Graph] Test problems after last commit

2012-03-02 Thread Simone Tripodi
I would have preferred a Concurrent* version for our data structures, but I can happily live with the synchronized version even if not the top. an initial quick implementation is done and already on SVN - I took few minutes to make it - so please check it out and and feel free to add improvements,

Re: [Graph] Test problems after last commit

2012-03-02 Thread Marco Speranza
> Sorry but at first reading it was not clear to me what you meant, > reading the second time I thought you maybe intended the > > related for [graph]? Yes Simo... I meant just what.

Re: [Graph] Test problems after last commit

2012-03-02 Thread Simone Tripodi
Hi again Marco, If I understood correctly what your idea is, I just added the methods you proposed - feel free to improve the implementation! Testcase are still a TODO but honestly I don't know how to verify that the thread-safe contract is respected... I had the same issue in [pool] I continued

Re: [Graph] Test problems after last commit

2012-03-02 Thread Simone Tripodi
> I think that we can create a class Graphs that has static methods to wrap > [graph] in a thread-safe way. > So the user can choose the preferred implementation. Sorry but at first reading it was not clear to me what you meant, reading the second time I thought you maybe intended the

Re: [Graph] Test problems after last commit

2012-03-02 Thread Simone Tripodi
Hola Marco, > Yep I think that [graph] has to be not thread safe, because if a user uses > [graph] in a not multi-thread environment the synchronization is not needed > and the performance degrade. given the fact that myself at first place wouldn't ever use these data structure in a production

Re: [Graph] Test problems after last commit

2012-03-02 Thread Marco Speranza
Hi simo, Yep I think that [graph] has to be not thread safe, because if a user uses [graph] in a not multi-thread environment the synchronization is not needed and the performance degrade. I think that we can create a class Graphs that has static methods to wrap [graph] in a thread-safe way.

Re: [Graph] Test problems after last commit

2012-03-02 Thread Simone Tripodi
why graphs shouldn't be thread safe? do you assume that users don't have to use [graph] in a multi-thread environment? following the java Collections class implementation means just rolling back the commits. -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http:

Re: [Graph] Test problems after last commit

2012-03-02 Thread Marco Speranza
Ciao Simo, I think that the problem is into concurrent implementation (SANDBOX-400). IMHO the BaseGraph has to be not thread safe because to manage the concurrency reduces the performance. I'm working on a possible solution. My idea is to follow the java Collections class implementation. If yo

Re: [Graph] Test problems after last commit

2012-03-02 Thread Simone Tripodi
yes, same here, not only is stuck but consumes a lot of memory, freezing the laptop as well! :O I'll investigate just after dinner if someone else won't be faster. best, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://w

[Graph] Test problems after last commit

2012-03-02 Thread Marco Speranza
Hi all, I run the test suite but after the latest commit it seems that the test org.apache.commons.graph.coloring.GraphColoringBackTrackingTestCase was frozen. Did you have the same problem? ciao -- Marco Speranza Google Code: http://code.google.com/u/marco.speranza79/ --