src/jdk/nashorn/internal/runtime/PropertyListenerManager.java

Print this page

        

*** 59,69 **** /** * Add a property listener to this object. * * @param listener The property listener that is added. */ ! public final void addPropertyListener(final PropertyListener listener) { if (listeners == null) { listeners = new WeakHashMap<>(); } if (Context.DEBUG) { --- 59,69 ---- /** * Add a property listener to this object. * * @param listener The property listener that is added. */ ! public synchronized final void addPropertyListener(final PropertyListener listener) { if (listeners == null) { listeners = new WeakHashMap<>(); } if (Context.DEBUG) {
*** 75,85 **** /** * Remove a property listener from this object. * * @param listener The property listener that is removed. */ ! public final void removePropertyListener(final PropertyListener listener) { if (listeners != null) { if (Context.DEBUG) { listenersRemoved++; } listeners.remove(listener); --- 75,85 ---- /** * Remove a property listener from this object. * * @param listener The property listener that is removed. */ ! public synchronized final void removePropertyListener(final PropertyListener listener) { if (listeners != null) { if (Context.DEBUG) { listenersRemoved++; } listeners.remove(listener);
*** 90,100 **** * This method can be called to notify property addition to this object's listeners. * * @param object The ScriptObject to which property was added. * @param prop The property being added. */ ! protected final void notifyPropertyAdded(final ScriptObject object, final Property prop) { if (listeners != null) { for (PropertyListener listener : listeners.keySet()) { listener.propertyAdded(object, prop); } } --- 90,100 ---- * This method can be called to notify property addition to this object's listeners. * * @param object The ScriptObject to which property was added. * @param prop The property being added. */ ! protected synchronized final void notifyPropertyAdded(final ScriptObject object, final Property prop) { if (listeners != null) { for (PropertyListener listener : listeners.keySet()) { listener.propertyAdded(object, prop); } }
*** 104,114 **** * This method can be called to notify property deletion to this object's listeners. * * @param object The ScriptObject from which property was deleted. * @param prop The property being deleted. */ ! protected final void notifyPropertyDeleted(final ScriptObject object, final Property prop) { if (listeners != null) { for (PropertyListener listener : listeners.keySet()) { listener.propertyDeleted(object, prop); } } --- 104,114 ---- * This method can be called to notify property deletion to this object's listeners. * * @param object The ScriptObject from which property was deleted. * @param prop The property being deleted. */ ! protected synchronized final void notifyPropertyDeleted(final ScriptObject object, final Property prop) { if (listeners != null) { for (PropertyListener listener : listeners.keySet()) { listener.propertyDeleted(object, prop); } }
*** 119,129 **** * * @param object The ScriptObject to which property was modified. * @param oldProp The old property being replaced. * @param newProp The new property that replaces the old property. */ ! protected final void notifyPropertyModified(final ScriptObject object, final Property oldProp, final Property newProp) { if (listeners != null) { for (PropertyListener listener : listeners.keySet()) { listener.propertyModified(object, oldProp, newProp); } } --- 119,129 ---- * * @param object The ScriptObject to which property was modified. * @param oldProp The old property being replaced. * @param newProp The new property that replaces the old property. */ ! protected synchronized final void notifyPropertyModified(final ScriptObject object, final Property oldProp, final Property newProp) { if (listeners != null) { for (PropertyListener listener : listeners.keySet()) { listener.propertyModified(object, oldProp, newProp); } }