Permalink
Browse files

GRAILS-9509 - improve reloading

There is a problem with stale JVM state that isn't cleared up properly on reload.  Spring Loaded is going to address this but for now the simplest thing for us to do is the change represented here in this commit.

See comments at http://jira.grails.org/browse/GRAILS-9509 for more info.
  • Loading branch information...
1 parent d264df5 commit 382f18789e25ad6c1f1d45e9397bbe5705cf561b @jeffbrown jeffbrown committed Nov 15, 2012
@@ -20,6 +20,7 @@
import org.codehaus.groovy.grails.commons.ClassPropertyFetcher;
import org.codehaus.groovy.grails.compiler.GrailsProjectWatcher;
import org.springframework.beans.CachedIntrospectionResults;
+import java.beans.Introspector;
/**
* Reloading agent plugin for use with the GrailsPluginManager.
@@ -37,11 +38,7 @@ public void reloadEvent(String typename, Class<?> aClass, String encodedTimestam
CachedIntrospectionResults.clearClassLoader(aClass.getClassLoader());
ClassPropertyFetcher.clearClassPropertyFetcherCache();
if (GrailsProjectWatcher.isActive()) {
- try {
- Thread.sleep(2500); // wait for a bit, to reduce chance of any concurrent issues with the timing of the reload reflecting in the JVM
- } catch (InterruptedException e) {
- // ignore
- }
+ Introspector.flushFromCaches(aClass);
GrailsProjectWatcher.firePendingClassChangeEvents(aClass);
}
}

0 comments on commit 382f187

Please sign in to comment.