You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by da...@apache.org on 2015/08/21 10:47:53 UTC
svn commit: r1696906 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java
Author: davide
Date: Fri Aug 21 08:47:53 2015
New Revision: 1696906
URL: http://svn.apache.org/r1696906
Log:
OAK-3258 - Async index should change thread name to improve log readability
- applying Vikas Saurabh's patch
- patch didn't apply cleanly. Applied by hand
- build was already failing
- should not be related to this patch
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java?rev=1696906&r1=1696905&r2=1696906&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java Fri Aug 21 08:47:53 2015
@@ -307,9 +307,11 @@ public class AsyncIndexUpdate implements
// there are some recent changes, so let's create a new checkpoint
String afterTime = now();
+ String oldThreadName = Thread.currentThread().getName();
+ boolean threadNameChanged = false;
String afterCheckpoint = store.checkpoint(lifetime, ImmutableMap.of(
"creator", AsyncIndexUpdate.class.getSimpleName(),
- "thread", Thread.currentThread().getName(),
+ "thread", oldThreadName,
"name", name));
NodeState after = store.retrieve(afterCheckpoint);
if (after == null) {
@@ -323,6 +325,11 @@ public class AsyncIndexUpdate implements
String checkpointToRelease = afterCheckpoint;
boolean updatePostRunStatus = false;
try {
+ String newThreadName = "aysnc-index-update-" + name;
+ log.trace("Switching thread name to {}", newThreadName);
+ threadNameChanged = true;
+ Thread.currentThread().setName(newThreadName);
+
updatePostRunStatus = updateIndex(before, beforeCheckpoint,
after, afterCheckpoint, afterTime);
@@ -351,6 +358,10 @@ public class AsyncIndexUpdate implements
}
} finally {
+ if (threadNameChanged) {
+ log.trace("Switching thread name back to {}", oldThreadName);
+ Thread.currentThread().setName(oldThreadName);
+ }
// null during initial indexing
// and skip release if this cp was used in a split operation
if (checkpointToRelease != null