* Add property read access to methods registered by PropertyRecorder.
Fixes bug 458 <http://www.helma.org/bugs/show_bug.cgi?id=458>. * Make all PropertyRecorder methods synchronized.
This commit is contained in:
parent
0aed9bbdc5
commit
7fadb9ce20
1 changed files with 8 additions and 4 deletions
|
@ -100,6 +100,10 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
|
|||
* @return the property for the given name
|
||||
*/
|
||||
public synchronized Object get(String name, Scriptable start) {
|
||||
// register property for PropertyRecorder interface
|
||||
if (isRecording) {
|
||||
changedProperties.add(name);
|
||||
}
|
||||
return super.get(name, start);
|
||||
}
|
||||
|
||||
|
@ -670,7 +674,7 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
|
|||
/**
|
||||
* Tell this PropertyRecorder to start recording changes to properties
|
||||
*/
|
||||
public void startRecording() {
|
||||
public synchronized void startRecording() {
|
||||
changedProperties = new HashSet();
|
||||
isRecording = true;
|
||||
}
|
||||
|
@ -678,7 +682,7 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
|
|||
/**
|
||||
* Tell this PropertyRecorder to stop recording changes to properties
|
||||
*/
|
||||
public void stopRecording() {
|
||||
public synchronized void stopRecording() {
|
||||
isRecording = false;
|
||||
}
|
||||
|
||||
|
@ -688,14 +692,14 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
|
|||
*
|
||||
* @return a Set containing the names of changed properties
|
||||
*/
|
||||
public Set getChangeSet() {
|
||||
public synchronized Set getChangeSet() {
|
||||
return changedProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the set of changed properties.
|
||||
*/
|
||||
public void clearChangeSet() {
|
||||
public synchronized void clearChangeSet() {
|
||||
changedProperties = null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue