Nice, thanks! Any chance you could port the thread dump code to 2.8.3 as well?

/Janne

On 5 Apr 2009, at 15:08, [email protected] wrote:

Author: metskem
Date: Sun Apr  5 12:08:52 2009
New Revision: 762074

URL: http://svn.apache.org/viewvc?rev=762074&view=rev
Log:
       * 3.0.0-svn-93

* added some code to Watchdog so that the stacktrace is dumped in case of a timeout, we dump stacktraces of all threads if the debuglevel is
          INFO or higher
       * got rid of some javadoc errors

Modified:
   incubator/jspwiki/trunk/ChangeLog
   incubator/jspwiki/trunk/src/java/org/apache/wiki/JCRWikiPage.java
   incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ EditActionBean.java incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ UploadActionBean.java incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ ViewActionBean.java incubator/jspwiki/trunk/src/java/org/apache/wiki/search/ SearchMatcher.java
   incubator/jspwiki/trunk/src/java/org/apache/wiki/util/WatchDog.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=762074&r1=762073&r2=762074&view=diff
= = = = = = = = ======================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Sun Apr  5 12:08:52 2009
@@ -1,3 +1,12 @@
+2009-04-05  Harry Metske <[email protected]>
+
+        * 3.0.0-svn-93
+
+ * added some code to Watchdog so that the stacktrace is dumped in case of + a timeout, we dump stacktraces of all threads if the debuglevel is
+           INFO or higher
+        * got rid of some javadoc errors
+
2009-04-04  Janne Jalkanen <[email protected]>

        * 3.0.0-svn-92

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/ JCRWikiPage.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/JCRWikiPage.java?rev=762074&r1=762073&r2=762074&view=diff
= = = = = = = = ====================================================================== --- incubator/jspwiki/trunk/src/java/org/apache/wiki/ JCRWikiPage.java (original) +++ incubator/jspwiki/trunk/src/java/org/apache/wiki/ JCRWikiPage.java Sun Apr 5 12:08:52 2009
@@ -26,20 +26,15 @@
import javax.jcr.*;
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.version.Version;
import javax.jcr.version.VersionException;

-import org.apache.wiki.api.WikiException;
import org.apache.wiki.api.WikiPage;
import org.apache.wiki.attachment.Attachment;
import org.apache.wiki.auth.acl.Acl;
-import org.apache.wiki.auth.acl.AclEntry;
-import org.apache.wiki.auth.acl.AclImpl;
import org.apache.wiki.content.ContentManager;
import org.apache.wiki.content.PageNotFoundException;
import org.apache.wiki.content.WikiName;
import org.apache.wiki.providers.ProviderException;
-import org.apache.wiki.providers.WikiPageProvider;


/**
@@ -140,8 +135,8 @@
    /**
     *  Direct access to JCR Properties.
     *
-     *  @param key
-     *  @return
+     *  @param key the key for which we want the property
+     *  @return Property
     *  @throws PathNotFoundException
     *  @throws RepositoryException
     */

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/ WikiEngine.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java?rev=762074&r1=762073&r2=762074&view=diff
= = = = = = = = ====================================================================== --- incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java (original) +++ incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java Sun Apr 5 12:08:52 2009
@@ -1096,7 +1096,7 @@
     *  <p>If the page is a special page, then returns a direct URL
     *  to that page.  Otherwise returns <code>null</code>.
     *  This method delegates requests to
- * {...@link org .apache .wiki.action.WikiContextFactory#getSpecialPageResolution(String)}. + * {...@link org.apache.wiki.action.WikiContextFactory#getSpecialPageURI}.
     *  </p>
     *  <p>
* Special pages are defined in jspwiki.properties using the jspwiki.specialPage

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ EditActionBean.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/action/EditActionBean.java?rev=762074&r1=762073&r2=762074&view=diff
= = = = = = = = ====================================================================== --- incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ EditActionBean.java (original) +++ incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ EditActionBean.java Sun Apr 5 12:08:52 2009
@@ -431,7 +431,7 @@
* Sets a flag indicating that new page text should be appended to the old
     * text.
     *
- * @param <code>true</code> if text should be appended; <code>false</code> + * @param append <code>true</code> if text should be appended; <code>false</code>
     *            otherwise (the default).
     */
    @Validate( required = false )
@@ -492,7 +492,7 @@
     * {...@link HtmlStringToWikiTranslator}. Calling this method causes
* {...@link #setText(String)} to be called, with the translated text supplied.
     *
-     * @param the HTML to translate
+     * @param html the HTML to translate
     * @throws JDOMException if the HTML cannot be translated
* @throws IOException if the HtmlStringToWikiTranslator cannot translated
     *             the text

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ UploadActionBean.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/action/UploadActionBean.java?rev=762074&r1=762073&r2=762074&view=diff
= = = = = = = = ====================================================================== --- incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ UploadActionBean.java (original) +++ incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ UploadActionBean.java Sun Apr 5 12:08:52 2009
@@ -100,7 +100,7 @@
    /**
* Handler method that uploads a new attachment to the ViewActionBean.
     *
-     * @return
+     * @return Resolution
     */
    @HandlesEvent( "upload" )
@HandlerPermission( permissionClass = PagePermission.class, target = "${page.qualifiedName}", actions = PagePermission.UPLOAD_ACTION )

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ ViewActionBean.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ViewActionBean.java?rev=762074&r1=762073&r2=762074&view=diff
= = = = = = = = ====================================================================== --- incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ ViewActionBean.java (original) +++ incubator/jspwiki/trunk/src/java/org/apache/wiki/action/ ViewActionBean.java Sun Apr 5 12:08:52 2009
@@ -112,7 +112,7 @@
* special page names from <code>jspwiki.properties</code>, and possible * aliases. To determine whether the page is a special page, this method
     * calls
- * {...@link org .apache .wiki.action.WikiContextFactory#getSpecialPageResolution(String)}. + * {...@link org.apache.wiki.action.WikiContextFactory#getSpecialPageURI(String)}.
     *
* @return a {...@link net.sourceforge.stripes.action.RedirectResolution} to * the special page's real URL, if a special page was specified, or

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/search/ SearchMatcher.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/search/SearchMatcher.java?rev=762074&r1=762073&r2=762074&view=diff
= = = = = = = = ====================================================================== --- incubator/jspwiki/trunk/src/java/org/apache/wiki/search/ SearchMatcher.java (original) +++ incubator/jspwiki/trunk/src/java/org/apache/wiki/search/ SearchMatcher.java Sun Apr 5 12:08:52 2009
@@ -167,7 +167,7 @@
        /**
         *  Create a new SearchResult with a given name and a score.
         *
-         *  @param name Page Name
+         *  @param page Page Name
         *  @param score A score from 0+
         */
        public SearchResultImpl( WikiPage page, int score )

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/util/ WatchDog.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/util/WatchDog.java?rev=762074&r1=762073&r2=762074&view=diff
= = = = = = = = ====================================================================== --- incubator/jspwiki/trunk/src/java/org/apache/wiki/util/ WatchDog.java (original) +++ incubator/jspwiki/trunk/src/java/org/apache/wiki/util/ WatchDog.java Sun Apr 5 12:08:52 2009
@@ -304,12 +304,10 @@

                if( now > st.getExpiryTime() )
                {
-                    log.info("Watchable '"+m_watchable.getName()+
-                             "' exceeded timeout in state '"+
-                             st.getState()+
-                             "' by "+
- (now-st.getExpiryTime())/1000+" seconds"); + log.info( "Watchable '" + m_watchable.getName() + "' exceeded timeout in state '" + st.getState() + "' by " + + (now - st.getExpiryTime()) / 1000 + " seconds" );

+                    dumpStackTraceForWatchable();
                    m_watchable.timeoutExceeded( st.getState() );
                }
            }
@@ -320,6 +318,28 @@
        }
    }

+    private void dumpStackTraceForWatchable()
+    {
+ Map<Thread, StackTraceElement[]> stackTraces = Thread.getAllStackTraces();
+        Set<Thread> threads = stackTraces.keySet();
+        Iterator<Thread> threadIterator = threads.iterator();
+        while ( threadIterator.hasNext() )
+        {
+            Thread t = (Thread) threadIterator.next();
+ if( t.getName().equals( m_watchable.getName() ) || log.isInfoEnabled() )
+            {
+ log.error( "dumping stacktrace for too long running thread : " + t );
+                StackTraceElement[] ste = stackTraces.get( t );
+ StringBuilder stacktrace = new StringBuilder( "stacktrace follows" );
+                for( int i = 0; i < ste.length; i++ )
+                {
+                    stacktrace.append( "\n" + ste[i] );
+                }
+                log.error( stacktrace.toString() );
+            }
+        }
+    }
+
    /**
     *  Strictly for debugging/informative purposes.
     *


Reply via email to