Fixed bug where prototype was marked as checked too early, resulting in
other evaluators to use the prototype is if the code was fully parsed/compiled.
This commit is contained in:
parent
a1080de978
commit
096541e347
1 changed files with 13 additions and 12 deletions
|
@ -193,11 +193,14 @@ public final class TypeManager {
|
||||||
|
|
||||||
if (proto == null)
|
if (proto == null)
|
||||||
return;
|
return;
|
||||||
if (System.currentTimeMillis() - proto.getLastCheck() < 1000)
|
// if prototype has been checked in the last 1.5 seconds, return
|
||||||
|
if (System.currentTimeMillis() - proto.getLastCheck() < 1500)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
synchronized (proto) {
|
synchronized (proto) {
|
||||||
if (System.currentTimeMillis() - proto.getLastCheck() < 1000)
|
// check again because another thread may have checked the
|
||||||
|
// prototype while we were waiting for access to the synchronized section
|
||||||
|
if (System.currentTimeMillis() - proto.getLastCheck() < 1500)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
File dir = new File (appDir, proto.getName());
|
File dir = new File (appDir, proto.getName());
|
||||||
|
@ -216,14 +219,8 @@ public final class TypeManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetch previous last-check timestamp and update it on prototype
|
|
||||||
// we do this here for the (not very likely but possible) case
|
|
||||||
// where files are created in the exact moment we are doing this check.
|
|
||||||
long lastcheck = proto.getLastCheck ();
|
|
||||||
proto.markChecked ();
|
|
||||||
|
|
||||||
// next we check if files have been created since last update
|
// next we check if files have been created since last update
|
||||||
if (lastcheck < dir.lastModified ()) {
|
if (proto.getLastCheck() < dir.lastModified ()) {
|
||||||
String[] list = dir.list();
|
String[] list = dir.list();
|
||||||
for (int i=0; i<list.length; i++) {
|
for (int i=0; i<list.length; i++) {
|
||||||
String fn = list[i];
|
String fn = list[i];
|
||||||
|
@ -238,9 +235,11 @@ public final class TypeManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if nothing needs to be updated, return now
|
// if nothing needs to be updated, mark prototype as checked and return
|
||||||
if (!needsUpdate)
|
if (!needsUpdate) {
|
||||||
|
proto.markChecked ();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// app.logEvent ("TypeManager: Updating prototypes for "+app.getName()+": "+updatables);
|
// app.logEvent ("TypeManager: Updating prototypes for "+app.getName()+": "+updatables);
|
||||||
|
|
||||||
|
@ -314,11 +313,13 @@ public final class TypeManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mark prototype as checked and updated.
|
||||||
|
proto.markChecked ();
|
||||||
proto.markUpdated();
|
proto.markUpdated();
|
||||||
|
|
||||||
} // end of synchronized (proto)
|
} // end of synchronized (proto)
|
||||||
|
|
||||||
// app.scriptingEngine.updatePrototype (proto);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue