Added syncrhonization to methods who's overridden parent methods have synchronization as well. (cherry picking from commit 36d2021fe7178d6686b5843c6f57bbf41bfd30c2)

This commit is contained in:
Daniel Ruthardt 2010-12-07 21:27:40 +01:00 committed by Tobi Schäfer
parent 468a89bd05
commit 5abe737912
2 changed files with 13 additions and 13 deletions

View file

@ -144,7 +144,7 @@ public class ResourceProperties extends Properties {
this.parentProperties = parentProperties; this.parentProperties = parentProperties;
this.prefix = prefix; this.prefix = prefix;
resources = new LinkedHashSet(); resources = new LinkedHashSet();
setIgnoreCase(parentProperties.ignoreCase); setIgnoreCase(parentProperties.ignoreCase);
forceUpdate(); forceUpdate();
} }
@ -483,7 +483,7 @@ public class ResourceProperties extends Properties {
* @param value value * @param value value
* @return the old value, if an old value got replaced * @return the old value, if an old value got replaced
*/ */
public Object put(Object key, Object value) { public synchronized Object put(Object key, Object value) {
if (value instanceof String) { if (value instanceof String) {
value = ((String) value).trim(); value = ((String) value).trim();
} }
@ -499,7 +499,7 @@ public class ResourceProperties extends Properties {
* @param key key * @param key key
* @return the old value * @return the old value
*/ */
public Object remove(Object key) { public synchronized Object remove(Object key) {
String strkey = key.toString(); String strkey = key.toString();
if (ignoreCase) { if (ignoreCase) {
strkey = (String) keyMap.remove(strkey.toLowerCase()); strkey = (String) keyMap.remove(strkey.toLowerCase());

View file

@ -199,7 +199,7 @@ public final class SystemProperties extends Properties {
* This should not be used directly if properties are read from file, * This should not be used directly if properties are read from file,
* otherwise changes will be lost whe the file is next modified. * otherwise changes will be lost whe the file is next modified.
*/ */
public Object put(Object key, Object value) { public synchronized Object put(Object key, Object value) {
// cut off trailing whitespace // cut off trailing whitespace
if (value != null) { if (value != null) {
value = value.toString().trim(); value = value.toString().trim();
@ -211,7 +211,7 @@ public final class SystemProperties extends Properties {
/** /**
* Overrides method to act on the wrapped properties object. * Overrides method to act on the wrapped properties object.
*/ */
public Object get(Object key) { public synchronized Object get(Object key) {
if ((System.currentTimeMillis() - lastcheck) > cacheTime) { if ((System.currentTimeMillis() - lastcheck) > cacheTime) {
checkFile(); checkFile();
} }
@ -222,14 +222,14 @@ public final class SystemProperties extends Properties {
/** /**
* Overrides method to act on the wrapped properties object. * Overrides method to act on the wrapped properties object.
*/ */
public Object remove(Object key) { public synchronized Object remove(Object key) {
return super.remove(ignoreCase ? key.toString().toLowerCase() : key); return super.remove(ignoreCase ? key.toString().toLowerCase() : key);
} }
/** /**
* Overrides method to act on the wrapped properties object. * Overrides method to act on the wrapped properties object.
*/ */
public boolean contains(Object obj) { public synchronized boolean contains(Object obj) {
if ((System.currentTimeMillis() - lastcheck) > cacheTime) { if ((System.currentTimeMillis() - lastcheck) > cacheTime) {
checkFile(); checkFile();
} }
@ -240,7 +240,7 @@ public final class SystemProperties extends Properties {
/** /**
* Overrides method to act on the wrapped properties object. * Overrides method to act on the wrapped properties object.
*/ */
public boolean containsKey(Object key) { public synchronized boolean containsKey(Object key) {
if ((System.currentTimeMillis() - lastcheck) > cacheTime) { if ((System.currentTimeMillis() - lastcheck) > cacheTime) {
checkFile(); checkFile();
} }
@ -251,7 +251,7 @@ public final class SystemProperties extends Properties {
/** /**
* Overrides method to act on the wrapped properties object. * Overrides method to act on the wrapped properties object.
*/ */
public boolean isEmpty() { public synchronized boolean isEmpty() {
if ((System.currentTimeMillis() - lastcheck) > cacheTime) { if ((System.currentTimeMillis() - lastcheck) > cacheTime) {
checkFile(); checkFile();
} }
@ -285,7 +285,7 @@ public final class SystemProperties extends Properties {
/** /**
* Overrides method to act on the wrapped properties object. * Overrides method to act on the wrapped properties object.
*/ */
public Enumeration keys() { public synchronized Enumeration keys() {
if ((System.currentTimeMillis() - lastcheck) > cacheTime) { if ((System.currentTimeMillis() - lastcheck) > cacheTime) {
checkFile(); checkFile();
} }
@ -307,7 +307,7 @@ public final class SystemProperties extends Properties {
/** /**
* Overrides method to act on the wrapped properties object. * Overrides method to act on the wrapped properties object.
*/ */
public Enumeration elements() { public synchronized Enumeration elements() {
if ((System.currentTimeMillis() - lastcheck) > cacheTime) { if ((System.currentTimeMillis() - lastcheck) > cacheTime) {
checkFile(); checkFile();
} }
@ -318,7 +318,7 @@ public final class SystemProperties extends Properties {
/** /**
* Overrides method to act on the wrapped properties object. * Overrides method to act on the wrapped properties object.
*/ */
public int size() { public synchronized int size() {
if ((System.currentTimeMillis() - lastcheck) > cacheTime) { if ((System.currentTimeMillis() - lastcheck) > cacheTime) {
checkFile(); checkFile();
} }
@ -329,7 +329,7 @@ public final class SystemProperties extends Properties {
/** /**
* Overrides method to act on the wrapped properties object. * Overrides method to act on the wrapped properties object.
*/ */
public String toString() { public synchronized String toString() {
return super.toString(); return super.toString();
} }