Author: jmarino
Date: Fri Oct 27 01:11:46 2006
New Revision: 468313
URL: http://svn.apache.org/viewvc?view=rev&rev=468313
Log:
minor store changes
Modified:
incubator/tuscany/java/sca/services/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStore.java
incubator/tuscany/java/sca/services/persistence/store.memory/src/main/java/org/apache/tuscany/service/persistence/store/memory/MemoryStore.java
Modified:
incubator/tuscany/java/sca/services/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStore.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStore.java?view=diff&rev=468313&r1=468312&r2=468313
==============================================================================
---
incubator/tuscany/java/sca/services/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStore.java
(original)
+++
incubator/tuscany/java/sca/services/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStore.java
Fri Oct 27 01:11:46 2006
@@ -19,6 +19,9 @@
package org.apache.tuscany.service.persistence.store.jdbc;
import java.util.LinkedHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
import org.osoa.sca.annotations.Destroy;
import org.osoa.sca.annotations.Init;
@@ -43,6 +46,9 @@
private StoreMonitor monitor;
private boolean writeBehind;
private long writeInterval;
+ // TODO integrate with a core threading scheme
+ private ScheduledExecutorService scheduler;
+ private long reaperInterval = 300000;
private LinkedHashMap<Object, Object> cache;
public JDBCStore(@Monitor StoreMonitor monitor) {
@@ -82,12 +88,29 @@
this.writeInterval = writeInterval;
}
+ /**
+ * Sets the interval for expired entry scanning to be performed
+ */
+ @Property
+ public void setReaperInterval(long reaperInterval) {
+ this.reaperInterval = reaperInterval;
+ }
+
+ /**
+ * Returns the interval for expired entry scanning to be performed
+ */
+ public long getReaperInterval() {
+ return reaperInterval;
+ }
+
@Init(eager = true)
public void init() {
- monitor.start("JDBC store started");
if (writeBehind) {
cache = new LinkedHashMap<Object, Object>();
}
+ this.scheduler = Executors.newSingleThreadScheduledExecutor();
+ scheduler.scheduleWithFixedDelay(new Reaper(), reaperInterval,
reaperInterval, TimeUnit.MILLISECONDS);
+ monitor.start("JDBC store started");
}
@Destroy
@@ -123,4 +146,22 @@
public void recover(RecoveryListener listener) {
}
+
+ private class Record {
+ private Object data;
+ private long expiration = NEVER;
+
+ public Record(Object data, long expiration) {
+ this.data = data;
+ this.expiration = expiration;
+ }
+ }
+
+ private class Reaper implements Runnable {
+
+ public void run() {
+ //long now = System.currentTimeMillis();
+ }
+ }
+
}
Modified:
incubator/tuscany/java/sca/services/persistence/store.memory/src/main/java/org/apache/tuscany/service/persistence/store/memory/MemoryStore.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/store.memory/src/main/java/org/apache/tuscany/service/persistence/store/memory/MemoryStore.java?view=diff&rev=468313&r1=468312&r2=468313
==============================================================================
---
incubator/tuscany/java/sca/services/persistence/store.memory/src/main/java/org/apache/tuscany/service/persistence/store/memory/MemoryStore.java
(original)
+++
incubator/tuscany/java/sca/services/persistence/store.memory/src/main/java/org/apache/tuscany/service/persistence/store/memory/MemoryStore.java
Fri Oct 27 01:11:46 2006
@@ -55,6 +55,9 @@
this.scheduler = Executors.newSingleThreadScheduledExecutor();
}
+ /**
+ * Sets the interval for expired entry scanning to be performed
+ */
@Property
public void setReaperInterval(long reaperInterval) {
this.reaperInterval = reaperInterval;
@@ -66,8 +69,8 @@
@Init(eager = true)
public void init() {
- monitor.start("In-memory store started");
scheduler.scheduleWithFixedDelay(new Reaper(), reaperInterval,
reaperInterval, TimeUnit.MILLISECONDS);
+ monitor.start("In-memory store started");
}
@Destroy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]