You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2008/04/16 19:31:04 UTC

svn commit: r648763 - /incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java

Author: rfeng
Date: Wed Apr 16 10:31:00 2008
New Revision: 648763

URL: http://svn.apache.org/viewvc?rev=648763&view=rev
Log:
Fix for TUSCANY-2069

Modified:
    incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java

Modified: incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java?rev=648763&r1=648762&r2=648763&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java (original)
+++ incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java Wed Apr 16 10:31:00 2008
@@ -26,6 +26,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * Directed, weighted graph
@@ -72,7 +73,8 @@
 
     }
 
-    private final Map<VertexPair, Path> paths = new HashMap<VertexPair, Path>();
+    // Fix for TUSCANY-2069, making the map concurrent
+    private final Map<VertexPair, Path> paths = new ConcurrentHashMap<VertexPair, Path>();
 
     /**
      * Vertex of a graph



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Re: svn commit: r648763 - /incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java

Posted by Simon Laws <si...@googlemail.com>.
On Thu, Apr 17, 2008 at 9:44 AM, Mark Combellack <mc...@apache.org>
wrote:

> I'm looking to fix this issue now
>
> I'm testing a fix and about to commit.
>
> Mark
>
>
> > -----Original Message-----
> > From: Simon Laws [mailto:simonslaws@googlemail.com]
> > Sent: 17 April 2008 09:42
> > To: tuscany-dev@ws.apache.org
> > Subject: Re: svn commit: r648763 -
> >
> /incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/t
> > uscany/sca/databinding/impl/DirectedGraph.java
> >
> > On Wed, Apr 16, 2008 at 6:31 PM, <rf...@apache.org> wrote:
> >
> > > Author: rfeng
> > > Date: Wed Apr 16 10:31:00 2008
> > > New Revision: 648763
> > >
> > > URL: http://svn.apache.org/viewvc?rev=648763&view=rev
> > > Log:
> > > Fix for TUSCANY-2069
> > >
> > > Modified:
> > >
> > >
> >
> incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tu
> > scany/sca/databinding/impl/DirectedGraph.java
> > >
> > > Modified:
> > >
> >
> incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tu
> > scany/sca/databinding/impl/DirectedGraph.java
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databindin
> >
> g/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
> > ?rev=648763&r1=648762&r2=648763&view=diff
> > >
> > >
> >
> ==========================================================================
> > ====
> > > ---
> > >
> >
> incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tu
> > scany/sca/databinding/impl/DirectedGraph.java
> > > (original)
> > > +++
> > >
> >
> incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tu
> > scany/sca/databinding/impl/DirectedGraph.java
> > > Wed Apr 16 10:31:00 2008
> > > @@ -26,6 +26,7 @@
> > >  import java.util.List;
> > >  import java.util.Map;
> > >  import java.util.Set;
> > > +import java.util.concurrent.ConcurrentHashMap;
> > >
> > >  /**
> > >  * Directed, weighted graph
> > > @@ -72,7 +73,8 @@
> > >
> > >     }
> > >
> > > -    private final Map<VertexPair, Path> paths = new
> HashMap<VertexPair,
> > > Path>();
> > > +    // Fix for TUSCANY-2069, making the map concurrent
> > > +    private final Map<VertexPair, Path> paths = new
> > > ConcurrentHashMap<VertexPair, Path>();
> > >
> > >     /**
> > >      * Vertex of a graph
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: tuscany-commits-help@ws.apache.org
> > >
> > >
> > Hi
> >
> > Don't know if anyone else is seeing this but this change is causing a
> NPE
> > in
> > DirectedGraphTestCase for me. Am looking at it now.
> >
> > Simon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
> Ok , great. Thanks Mark. I'll hold back then. Let me know if you need any
help.

Simon

RE: svn commit: r648763 - /incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java

Posted by Mark Combellack <mc...@apache.org>.
I'm looking to fix this issue now

I'm testing a fix and about to commit.

Mark


> -----Original Message-----
> From: Simon Laws [mailto:simonslaws@googlemail.com]
> Sent: 17 April 2008 09:42
> To: tuscany-dev@ws.apache.org
> Subject: Re: svn commit: r648763 -
> /incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/t
> uscany/sca/databinding/impl/DirectedGraph.java
> 
> On Wed, Apr 16, 2008 at 6:31 PM, <rf...@apache.org> wrote:
> 
> > Author: rfeng
> > Date: Wed Apr 16 10:31:00 2008
> > New Revision: 648763
> >
> > URL: http://svn.apache.org/viewvc?rev=648763&view=rev
> > Log:
> > Fix for TUSCANY-2069
> >
> > Modified:
> >
> >
> incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tu
> scany/sca/databinding/impl/DirectedGraph.java
> >
> > Modified:
> >
> incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tu
> scany/sca/databinding/impl/DirectedGraph.java
> > URL:
> >
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databindin
> g/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
> ?rev=648763&r1=648762&r2=648763&view=diff
> >
> >
> ==========================================================================
> ====
> > ---
> >
> incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tu
> scany/sca/databinding/impl/DirectedGraph.java
> > (original)
> > +++
> >
> incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tu
> scany/sca/databinding/impl/DirectedGraph.java
> > Wed Apr 16 10:31:00 2008
> > @@ -26,6 +26,7 @@
> >  import java.util.List;
> >  import java.util.Map;
> >  import java.util.Set;
> > +import java.util.concurrent.ConcurrentHashMap;
> >
> >  /**
> >  * Directed, weighted graph
> > @@ -72,7 +73,8 @@
> >
> >     }
> >
> > -    private final Map<VertexPair, Path> paths = new HashMap<VertexPair,
> > Path>();
> > +    // Fix for TUSCANY-2069, making the map concurrent
> > +    private final Map<VertexPair, Path> paths = new
> > ConcurrentHashMap<VertexPair, Path>();
> >
> >     /**
> >      * Vertex of a graph
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-commits-help@ws.apache.org
> >
> >
> Hi
> 
> Don't know if anyone else is seeing this but this change is causing a NPE
> in
> DirectedGraphTestCase for me. Am looking at it now.
> 
> Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: svn commit: r648763 - /incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java

Posted by Raymond Feng <en...@gmail.com>.
Sorry for the break. I didn't realize that ConcurrentHashMap doesn't allow 
null values. I'll try to optimize it by adding a special NULL object.

Thanks,
Raymond
--------------------------------------------------
From: "Mark Combellack" <mc...@apache.org>
Sent: Thursday, April 17, 2008 1:55 AM
To: <tu...@ws.apache.org>
Subject: RE: svn commit: r648763 - 
/incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java

> I've committed a fix that checks for null before doing the insert. This
> means that the unit tests now pass.
>
> I've re-opened TUSCANY-2069 so the change can be validated. If the code
> really must insert null then we need to do something different - e.g. 
> revert
> collection or add a "marker value" to represent null.
>
> Mark
>
>> -----Original Message-----
>> From: Ramkumar R [mailto:ramkumar.rj@gmail.com]
>> Sent: 17 April 2008 09:52
>> To: tuscany-dev@ws.apache.org
>> Subject: Re: svn commit: r648763 -
>> /incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/t
>> uscany/sca/databinding/impl/DirectedGraph.java
>>
>> Hi Simon,
>> I am also facing this issue, here Raymond have used ConcurrentHashMap to
>> resolve the issue as mentioned in TUSCANY-2069, but we can't be using
>> ConcurrentHashMap in this case as this collection (ConcurrentHashMap) 
>> does
>> not allow null value to be inserted in the Map. Since the
>> DirectedGraph.java
>> class explicitly tries to insert null value in its getShortestPath()
>> method
>> we see this exception. For now we can revert to the old code of having
>> HashMap to resolve this issue.
>>
>> --
>> Thanks & Regards,
>> Ramkumar Ramalingam
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


RE: svn commit: r648763 - /incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java

Posted by Mark Combellack <mc...@apache.org>.
I've committed a fix that checks for null before doing the insert. This
means that the unit tests now pass.

I've re-opened TUSCANY-2069 so the change can be validated. If the code
really must insert null then we need to do something different - e.g. revert
collection or add a "marker value" to represent null.

Mark

> -----Original Message-----
> From: Ramkumar R [mailto:ramkumar.rj@gmail.com]
> Sent: 17 April 2008 09:52
> To: tuscany-dev@ws.apache.org
> Subject: Re: svn commit: r648763 -
> /incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/t
> uscany/sca/databinding/impl/DirectedGraph.java
> 
> Hi Simon,
> I am also facing this issue, here Raymond have used ConcurrentHashMap to
> resolve the issue as mentioned in TUSCANY-2069, but we can't be using
> ConcurrentHashMap in this case as this collection (ConcurrentHashMap) does
> not allow null value to be inserted in the Map. Since the
> DirectedGraph.java
> class explicitly tries to insert null value in its getShortestPath()
> method
> we see this exception. For now we can revert to the old code of having
> HashMap to resolve this issue.
> 
> --
> Thanks & Regards,
> Ramkumar Ramalingam


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: svn commit: r648763 - /incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java

Posted by Ramkumar R <ra...@gmail.com>.
Hi Simon,
I am also facing this issue, here Raymond have used ConcurrentHashMap to
resolve the issue as mentioned in TUSCANY-2069, but we can't be using
ConcurrentHashMap in this case as this collection (ConcurrentHashMap) does
not allow null value to be inserted in the Map. Since the DirectedGraph.java
class explicitly tries to insert null value in its getShortestPath() method
we see this exception. For now we can revert to the old code of having
HashMap to resolve this issue.

-- 
Thanks & Regards,
Ramkumar Ramalingam

Re: svn commit: r648763 - /incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java

Posted by Simon Laws <si...@googlemail.com>.
On Wed, Apr 16, 2008 at 6:31 PM, <rf...@apache.org> wrote:

> Author: rfeng
> Date: Wed Apr 16 10:31:00 2008
> New Revision: 648763
>
> URL: http://svn.apache.org/viewvc?rev=648763&view=rev
> Log:
> Fix for TUSCANY-2069
>
> Modified:
>
>  incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
>
> Modified:
> incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java?rev=648763&r1=648762&r2=648763&view=diff
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
> Wed Apr 16 10:31:00 2008
> @@ -26,6 +26,7 @@
>  import java.util.List;
>  import java.util.Map;
>  import java.util.Set;
> +import java.util.concurrent.ConcurrentHashMap;
>
>  /**
>  * Directed, weighted graph
> @@ -72,7 +73,8 @@
>
>     }
>
> -    private final Map<VertexPair, Path> paths = new HashMap<VertexPair,
> Path>();
> +    // Fix for TUSCANY-2069, making the map concurrent
> +    private final Map<VertexPair, Path> paths = new
> ConcurrentHashMap<VertexPair, Path>();
>
>     /**
>      * Vertex of a graph
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-commits-help@ws.apache.org
>
>
Hi

Don't know if anyone else is seeing this but this change is causing a NPE in
DirectedGraphTestCase for me. Am looking at it now.

Simon