You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by an...@apache.org on 2014/04/16 17:11:30 UTC
svn commit: r1587938 -
/myfaces/trinidad/branches/andy-trinidad-2468/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
Author: andys
Date: Wed Apr 16 15:11:30 2014
New Revision: 1587938
URL: http://svn.apache.org/r1587938
Log:
Tweaking InterruptedException handling.
Modified:
myfaces/trinidad/branches/andy-trinidad-2468/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
Modified: myfaces/trinidad/branches/andy-trinidad-2468/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/andy-trinidad-2468/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java?rev=1587938&r1=1587937&r2=1587938&view=diff
==============================================================================
--- myfaces/trinidad/branches/andy-trinidad-2468/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java (original)
+++ myfaces/trinidad/branches/andy-trinidad-2468/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java Wed Apr 16 15:11:30 2014
@@ -530,16 +530,19 @@ public class FileSystemStyleCache implem
}
catch (InterruptedException ie)
{
- // Important to restore interrupted state, even if we are going to
- // throw a runtime exception.
- interrupted = true;
-
// Our thread was either interrupted just before the get() call, or
// while waiting inside of the get(). Our retry attempt failed. We
// could carry on without a style sheet, but this will only lead to
// confusion, so we choose to fail visibly instead and hope that things
// go better on the next request.
_logAndRethrowEntryGetFailure(context, document, ie, "STYLE_ENTRY_RETRIEVAL_INTERRUPTED");
+
+ // Note that we could call Thread.currentThread().interrupt() here, but choose
+ // not to do so because a) we are effectively ending the request by throwing
+ // an exception and b) marking the thread as interrupted seems to interfere
+ // with MyFaces error handling. If thread is marked as interrupted, I am
+ // not seeing the MyFaces-generated error page - just an empty status 200
+ // response.
}
catch (ExecutionException ee)
{
@@ -556,7 +559,7 @@ public class FileSystemStyleCache implem
if (interrupted)
{
Thread.currentThread().interrupt();
- }
+ }
}
return null;
@@ -601,6 +604,11 @@ public class FileSystemStyleCache implem
*
* The message is formatted with a single parameter: the name of the target
* style sheet that we were attempting to retrieve.
+ *
+ * @param contex the current style context
+ * @param document the style sheet document
+ * @param e an exception thrown by Future.get(). This is typically
+ * either ExecutionException or InterruptedException
*/
private void _logAndRethrowEntryGetFailure(
StyleContext context,
@@ -615,6 +623,7 @@ public class FileSystemStyleCache implem
String targetName = getTargetStyleSheetName(context, document);
_LOG.severe(message, targetName);
+ _LOG.fine(e);
Throwable cause = e.getCause();
if (cause instanceof RuntimeException)
@@ -625,10 +634,16 @@ public class FileSystemStyleCache implem
{
throw (Error)cause;
}
- else
+ else if (cause instanceof Exception)
{
throw new IllegalStateException(cause);
}
+ else
+ {
+ // This is the InterruptedException case, since InterruptedExceptions
+ // don't have a cause.
+ throw new IllegalStateException(message);
+ }
}
/**