[Schmitzm-commits] r1846 - trunk/schmitzm-core/src/main/java/de/schmitzm/lang
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Jan 30 04:26:10 CET 2012
Author: alfonx
Date: 2012-01-30 04:26:07 +0100 (Mon, 30 Jan 2012)
New Revision: 1846
Modified:
trunk/schmitzm-core/src/main/java/de/schmitzm/lang/TimedHashMap.java
Log:
Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/lang/TimedHashMap.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/lang/TimedHashMap.java 2012-01-30 03:09:18 UTC (rev 1845)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/lang/TimedHashMap.java 2012-01-30 03:26:07 UTC (rev 1846)
@@ -44,33 +44,31 @@
}
@Override
- public V put(K key, V value) {
+ synchronized public V put(K key, V value) {
if (timeout > 0) {
- synchronized (cleanTask) {
- // Timeour ms Nach dem letzten put die komplette hashmap leeren.
- if (cleanTask != null) {
- cleanTask.stop();
- }
+ // Timeour ms Nach dem letzten put die komplette hashmap leeren.
+ if (cleanTask != null) {
+ cleanTask.stop();
+ }
- cleanTask = new Timer(timeout + 1, new ActionListener() {
+ cleanTask = new Timer(timeout + 1, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- clear();
- inputTimes.clear();
- if (cleanTask != null) {
- cleanTask.stop();
- cleanTask = null;
- }
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ clear();
+ inputTimes.clear();
+ if (cleanTask != null) {
+ cleanTask.stop();
+ cleanTask = null;
}
+ }
- });
- cleanTask.setInitialDelay(timeout);
- cleanTask.setRepeats(false);
- cleanTask.start();
- }
+ });
+ cleanTask.setInitialDelay(timeout);
+ cleanTask.setRepeats(false);
+ cleanTask.start();
inputTimes.put(key, Long.valueOf(System.currentTimeMillis()));
return super.put(key, value);
More information about the Schmitzm-commits
mailing list