Update of
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/publisher/cache
In directory james.mmbase.org:/tmp/cvs-serv21288
Modified Files:
CacheFactory.java CacheFreshTask.java CacheInfo.java
DefaultCache.java ICache.java
Log Message:
CMSC-899,Check and improve all lists according to guideline,delete tab character
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/publisher/cache
See also: http://www.mmbase.org/jira/browse/CMSC-899
Index: CacheFactory.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/publisher/cache/CacheFactory.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- CacheFactory.java 22 Sep 2008 10:50:26 -0000 1.5
+++ CacheFactory.java 22 Sep 2008 10:52:27 -0000 1.6
@@ -13,7 +13,9 @@
/**
* get caches'cahe
- * @param caches f
+ *
+ * @param caches
+ * f
* @return ICache
*/
@@ -33,6 +35,7 @@
/**
* get time
+ *
* @param null
* @return ICache
*/
@@ -42,6 +45,7 @@
/**
* getDefaultCache
+ *
* @param time
* @return ICache
*/
Index: CacheFreshTask.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/publisher/cache/CacheFreshTask.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- CacheFreshTask.java 22 Sep 2008 10:50:26 -0000 1.4
+++ CacheFreshTask.java 22 Sep 2008 10:52:27 -0000 1.5
@@ -3,22 +3,22 @@
import java.util.Iterator;
import java.util.Map;
import java.util.TimerTask;
+
/**
* @author nikko yin
*/
-public class CacheFreshTask extends TimerTask{
+public class CacheFreshTask extends TimerTask {
private DefaultCache cache;
- /*FreshTask */
+ /* FreshTask */
public CacheFreshTask(DefaultCache cache) {
this.cache = cache;
}
- /*Start Thread*/
+ /* Start Thread */
public void run() {
synchronized (cache.getDatas()) {
- Iterator<Map.Entry<String, CacheInfo>> iterator
- = cache.getDatas().entrySet().iterator();
+ Iterator<Map.Entry<String, CacheInfo>> iterator =
cache.getDatas().entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, CacheInfo> entry = iterator.next();
CacheInfo ci = entry.getValue();
Index: CacheInfo.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/publisher/cache/CacheInfo.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- CacheInfo.java 22 Sep 2008 08:53:22 -0000 1.4
+++ CacheInfo.java 22 Sep 2008 10:52:27 -0000 1.5
@@ -1,4 +1,5 @@
package com.finalist.newsletter.publisher.cache;
+
/**
* @author nikko yin
*/
@@ -20,7 +21,7 @@
return obj;
}
- //getSecondsRemain
+ // getSecondsRemain
public long getSecondsRemain() {
return secondsRemain;
}
@@ -29,8 +30,10 @@
public long getTotalSeconds() {
return cacheSeconds;
}
+
/**
* setSecondsRemain
+ *
* @param null
*/
public void setSecondsRemain(long secondsRemain) {
Index: DefaultCache.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/publisher/cache/DefaultCache.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- DefaultCache.java 22 Sep 2008 08:53:22 -0000 1.5
+++ DefaultCache.java 22 Sep 2008 10:52:27 -0000 1.6
@@ -5,94 +5,110 @@
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
+
/**
* @author nikko yin
*/
-public class DefaultCache implements ICache{
+public class DefaultCache implements ICache {
private static final int FreshTimerIntervalSeconds = 1;
private Map<String, CacheInfo> datas;
- private long time=1800;
+ private long time = 1800;
private Timer timer;
public DefaultCache() {
- //synchronized cache when instance it
+ // synchronized cache when instance it
datas = Collections.synchronizedMap(new HashMap<String,
CacheInfo>());
- //flush cache
+ // flush cache
TimerTask task = new CacheFreshTask(this);
timer = new Timer("Cache_Timer", true);
- //flush when every second
+ // flush when every second
timer.scheduleAtFixedRate(task, 1000, FreshTimerIntervalSeconds
* 1000);
}
// implement the interface
public DefaultCache(long time) {
this();
- this.time=time;
+ this.time = time;
}
- //* add
+ // * add
public void add(Object key, Object value) {
- add(key, value,time);
+ add(key, value, time);
}
+
/**
* add
- * @param Object , Object and long
+ *
+ * @param Object ,
+ * Object and long
*/
public void add(Object key, Object value, long slidingExpiration) {
- if(slidingExpiration!=0){
- CacheInfo ci=new CacheInfo(value, slidingExpiration);
+ if (slidingExpiration != 0) {
+ CacheInfo ci = new CacheInfo(value, slidingExpiration);
datas.put((String) key, ci);
}
}
// contains
public boolean contains(Object key) {
- if(datas.containsKey(key))return true;
+ if (datas.containsKey(key)) return true;
return false;
}
+
/**
* get
+ *
* @param Object
*/
public Object get(Object key) {
- if(datas.containsKey(key)){
- CacheInfo ci=datas.get(key);
- //cahce'life will refresh when it's invoke ;)
+ if (datas.containsKey(key)) {
+ CacheInfo ci = datas.get(key);
+ // cahce'life will refresh when it's invoke ;)
ci.setSecondsRemain(ci.getTotalSeconds());
return ci.getObj();
}
return null;
}
+
/**
* remove
+ *
* @param Object
*/
public void remove(Object key) {
datas.remove(key);
}
+
/**
* removeAll
+ *
* @param null
*/
public void removeAll() {
}
+
/**
* getTime
+ *
* @param null
*/
public long getTime() {
return time;
}
+
/**
* setTime
+ *
* @param time
*/
public void setTime(long time) {
this.time = time;
}
+
/**
* getDatas
+ *
* @param null
*/
public Map<String, CacheInfo> getDatas() {
Index: ICache.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/publisher/cache/ICache.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs