You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by gr...@apache.org on 2005/03/17 04:12:19 UTC

svn commit: r157871 - lenya/trunk/src/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java

Author: gregor
Date: Wed Mar 16 19:12:18 2005
New Revision: 157871

URL: http://svn.apache.org/viewcvs?view=rev&rev=157871
Log:
Sychronized all methods in DefaultSiteTree. This resolves http://issues.apache.org/bugzilla/show_bug.cgi?id=33908

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java?view=diff&r1=157870&r2=157871
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java Wed Mar 16 19:12:18 2005
@@ -121,7 +121,7 @@
      * Checks if the tree file has been modified externally and reloads the site
      * tree.
      */
-    protected void checkModified() {
+    protected synchronized void checkModified() {
         if (this.area.equals(Publication.LIVE_AREA) && this.treefile.isFile()
                 && this.treefile.lastModified() > this.lastModified) {
 
@@ -143,7 +143,7 @@
      * @return the new site document
      * @throws ParserConfigurationException if an error occurs
      */
-    public Document createDocument() throws ParserConfigurationException {
+    public synchronized Document createDocument() throws ParserConfigurationException {
         this.document = DocumentHelper.createDocument(NAMESPACE_URI, "site", null);
 
         Element root = this.document.getDocumentElement();
@@ -162,7 +162,7 @@
      * @param ids list of node ids
      * @return the node that matches the path given in the list of ids
      */
-    protected Node findNode(Node node, List ids) {
+    protected synchronized Node findNode(Node node, List ids) {
 
         checkModified();
 
@@ -380,7 +380,7 @@
      * @return the Node if there is a Node for the given document-id, null
      *         otherwise
      */
-    private Node getNodeInternal(String documentId) {
+    private synchronized Node getNodeInternal(String documentId) {
         StringTokenizer st = new StringTokenizer(documentId, "/");
         ArrayList ids = new ArrayList();
 
@@ -395,7 +395,7 @@
     /**
      * @see org.apache.lenya.cms.site.tree.SiteTree#getNode(java.lang.String)
      */
-    public SiteTreeNode getNode(String documentId) {
+    public synchronized SiteTreeNode getNode(String documentId) {
         assert documentId != null;
 
         SiteTreeNode treeNode = null;



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


Re: svn commit: r157871 - lenya/trunk/src/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java

Posted by Andreas Hartmann <an...@apache.org>.
gregor@apache.org wrote:
> Author: gregor
> Date: Wed Mar 16 19:12:18 2005
> New Revision: 157871
> 
> URL: http://svn.apache.org/viewcvs?view=rev&rev=157871
> Log:
> Sychronized all methods in DefaultSiteTree. This resolves http://issues.apache.org/bugzilla/show_bug.cgi?id=33908

Actually that shouldn't be necessary in 1.4.

The sitetree object used to be shared by all threads. But now
it is stored in the DocumentIdentityMap, which means only one
thread accesses a sitetree object.

Anyway, the synchronisation shouldn't do any harm :)

-- Andreas


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