Le 07/03/16 14:58, Chris Pike a écrit :
> So loadGraph doesn't build a new SimpleDirectedGraph? Can you point me to 
> where it is reusing an existing object?

Ok, let's go back to the original issue :-)

https://issues.apache.org/jira/browse/FC-38?jql=project%20%3D%20FC


May be, back then, we just totaly fucked up when we replaced the
synchronized block by this crazy (and buggy) ReantrantRWLock.


 343     /**
 344      *
 345      * @param contextId maps to sub-tree in DIT, for example
ou=contextId, dc=jts, dc = com.
 346      * @return
 347      */
 348     private static SimpleDirectedGraph<String, Relationship>
getGraph( String contextId )
 349     {
 350         SimpleDirectedGraph<String, Relationship> graph = (
SimpleDirectedGraph<String, Relationship> ) roleCache
 351             .get( getKey( contextId ) );
 352         if ( graph == null )
 353         {
 354             graph = loadGraph( contextId );
 355         }
 356         return graph;
 357     }


 295     /**
 296      * Read this ldap record,{@code cn=Hierarchies, ou=OS-P} into
this entity, {@link Hier}, before loading into this collection
class,{@code org.jgrapht.graph.SimpleDirectedGraph}
 297      * using 3rd party lib, <a
href="http://www.jgrapht.org/";>JGraphT</a>.
 298      *
 299      * @param contextId maps to sub-tree in DIT, for example
ou=contextId, dc=jts, dc = com.
 300      * @return
 301      */
 302     private static SimpleDirectedGraph<String, Relationship>
loadGraph( String contextId )
 303     {
 304         Hier inHier = new Hier( Hier.Type.ROLE );
 305         inHier.setContextId( contextId );
 306         LOG.info( "loadGraph initializing ROLE context [" +
inHier.getContextId() + "]" );
 307         List<Graphable> descendants = null;
 308         try
 309         {
 310             descendants = roleP.getAllDescendants(
inHier.getContextId() );
 311         }
 312         catch ( SecurityException se )
 313         {
 314             LOG.info( "loadGraph caught SecurityException=" + se );
 315         }
 316         Hier hier = HierUtil.loadHier( contextId, descendants );
 317         SimpleDirectedGraph<String, Relationship> graph;
 318         synchronized ( HierUtil.getLock( contextId,
HierUtil.Type.ROLE ) )
 319         {
 320             graph = HierUtil.buildGraph( hier );
 321         }
 322         roleCache.put( getKey( contextId ), graph );
 323         return graph;
 324     }



What about re-thinking the whole stuff, which is a bit far from my head
(2014) ?

Reply via email to