You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2010/03/25 15:12:38 UTC
svn commit: r927415 -
/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/refresh/FileChangedDaemon.java
Author: werpu
Date: Thu Mar 25 14:12:37 2010
New Revision: 927415
URL: http://svn.apache.org/viewvc?rev=927415&view=rev
Log:
adding comments
Modified:
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/refresh/FileChangedDaemon.java
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/refresh/FileChangedDaemon.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/refresh/FileChangedDaemon.java?rev=927415&r1=927414&r2=927415&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/refresh/FileChangedDaemon.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/refresh/FileChangedDaemon.java Thu Mar 25 14:12:37 2010
@@ -33,14 +33,14 @@ import java.util.logging.Level;
import java.util.logging.Logger;
/**
+ * Reimplementation of the file changed daemon thread
+ * in java. The original one was done in groovy
+ * this threads purpose is to watch the files
+ * loaded by the various engine loaders for
+ * for file changes and then if one has changed we have to mark
+ * it for further processing
+ *
* @author werpu
- * Reimplementation of the file changed daemon thread
- * in java. The original one was done in groovy
- * this threads purpose is to watch the files
- * loaded by the various engine loaders for
- * for file changes and then if one has changed we have to mark
- * it for further processing
- * <p/>
*/
public class FileChangedDaemon extends Thread {
@@ -49,7 +49,6 @@ public class FileChangedDaemon extends T
Map<String, ReloadingMetadata> classMap = new ConcurrentHashMap<String, ReloadingMetadata>(8, 0.75f, 1);
ClassDependencies dependencyMap = new ClassDependencies();
-
/**
* this map is a shortcut for the various scripting engines
* it keeps track whether the engines source paths
@@ -78,8 +77,14 @@ public class FileChangedDaemon extends T
}
public static synchronized FileChangedDaemon getInstance() {
+ //we currently keep it as singleton but in the long run we will move it into the context
+ //like everything else singleton-wise
if (instance == null) {
instance = new FileChangedDaemon();
+ /**
+ * daemon thread to allow forced
+ * shutdowns for web context restarts
+ */
instance.setDaemon(true);
instance.setRunning(true);
instance.start();
@@ -89,6 +94,10 @@ public class FileChangedDaemon extends T
return instance;
}
+ /**
+ * Central run method
+ * which performs the entire scanning process
+ */
public void run() {
while (running) {
if (externalContext != null && !contextInitialized) {
@@ -125,7 +134,7 @@ public class FileChangedDaemon extends T
*/
private final void checkForChanges() {
ScriptingWeaver weaver = WeavingContext.getWeaver();
- if(weaver == null) return;
+ if (weaver == null) return;
weaver.scanForAddedClasses();
//TODO move this code also into the weaver so that
@@ -143,7 +152,7 @@ public class FileChangedDaemon extends T
printInfo(it, proxyFile);
meta.setTimestamp(proxyFile.lastModified());
dependencyTainted(meta.getAClass().getName());
-
+
//we add our log entry for further reference
WeavingContext.getRefreshContext().addTaintLogEntry(meta);
}
@@ -157,7 +166,7 @@ public class FileChangedDaemon extends T
* recursive walk over our meta data to taint also the classes
* which refer to our refreshing class so that those
* are reloaded as well, this helps to avoid classcast
- * exceptions caused by imports and casts on long running artefacts
+ * exceptions caused by imports and casts on long running artifacts
*
* @param className the origin classname which needs to be walked recursively
*/