Showing
2 changed files
with
10 additions
and
12 deletions
... | @@ -103,12 +103,6 @@ | ... | @@ -103,12 +103,6 @@ |
103 | <artifactId>hazelcast</artifactId> | 103 | <artifactId>hazelcast</artifactId> |
104 | </dependency> | 104 | </dependency> |
105 | 105 | ||
106 | - <dependency> | ||
107 | - <groupId>net.jodah</groupId> | ||
108 | - <artifactId>expiringmap</artifactId> | ||
109 | - <version>0.3.1</version> | ||
110 | - </dependency> | ||
111 | - | ||
112 | <!-- for shaded copycat --> | 106 | <!-- for shaded copycat --> |
113 | <dependency> | 107 | <dependency> |
114 | <groupId>org.onlab.onos</groupId> | 108 | <groupId>org.onlab.onos</groupId> | ... | ... |
... | @@ -20,12 +20,11 @@ import java.io.IOException; | ... | @@ -20,12 +20,11 @@ import java.io.IOException; |
20 | import java.util.HashMap; | 20 | import java.util.HashMap; |
21 | import java.util.Map; | 21 | import java.util.Map; |
22 | import java.util.Objects; | 22 | import java.util.Objects; |
23 | -import java.util.concurrent.TimeUnit; | ||
24 | import java.util.concurrent.atomic.AtomicBoolean; | 23 | import java.util.concurrent.atomic.AtomicBoolean; |
25 | 24 | ||
26 | -import net.jodah.expiringmap.ExpiringMap; | 25 | +//import net.jodah.expiringmap.ExpiringMap; |
27 | -import net.jodah.expiringmap.ExpiringMap.ExpirationListener; | 26 | +//import net.jodah.expiringmap.ExpiringMap.ExpirationListener; |
28 | -import net.jodah.expiringmap.ExpiringMap.ExpirationPolicy; | 27 | +//import net.jodah.expiringmap.ExpiringMap.ExpirationPolicy; |
29 | import net.kuujo.copycat.cluster.Member; | 28 | import net.kuujo.copycat.cluster.Member; |
30 | import net.kuujo.copycat.event.EventHandler; | 29 | import net.kuujo.copycat.event.EventHandler; |
31 | import net.kuujo.copycat.event.LeaderElectEvent; | 30 | import net.kuujo.copycat.event.LeaderElectEvent; |
... | @@ -56,7 +55,7 @@ public class DatabaseUpdateEventHandler implements | ... | @@ -56,7 +55,7 @@ public class DatabaseUpdateEventHandler implements |
56 | private final Member localMember; | 55 | private final Member localMember; |
57 | private final AtomicBoolean isLocalMemberLeader = new AtomicBoolean(false); | 56 | private final AtomicBoolean isLocalMemberLeader = new AtomicBoolean(false); |
58 | private final Map<String, Map<DatabaseRow, Void>> tableEntryExpirationMap = new HashMap<>(); | 57 | private final Map<String, Map<DatabaseRow, Void>> tableEntryExpirationMap = new HashMap<>(); |
59 | - private final ExpirationListener<DatabaseRow, Void> expirationObserver = new ExpirationObserver(); | 58 | + //private final ExpirationListener<DatabaseRow, Void> expirationObserver = new ExpirationObserver(); |
60 | 59 | ||
61 | DatabaseUpdateEventHandler(Member localMember) { | 60 | DatabaseUpdateEventHandler(Member localMember) { |
62 | this.localMember = localMember; | 61 | this.localMember = localMember; |
... | @@ -95,12 +94,15 @@ public class DatabaseUpdateEventHandler implements | ... | @@ -95,12 +94,15 @@ public class DatabaseUpdateEventHandler implements |
95 | // make this explicit instead of relying on a negative value | 94 | // make this explicit instead of relying on a negative value |
96 | // to indicate no expiration. | 95 | // to indicate no expiration. |
97 | if (expirationTimeMillis > 0) { | 96 | if (expirationTimeMillis > 0) { |
98 | - tableEntryExpirationMap.put(tableName, ExpiringMap.builder() | 97 | + tableEntryExpirationMap.put(tableName, null); |
98 | + /* | ||
99 | + ExpiringMap.builder() | ||
99 | .expiration(expirationTimeMillis, TimeUnit.SECONDS) | 100 | .expiration(expirationTimeMillis, TimeUnit.SECONDS) |
100 | .expirationListener(expirationObserver) | 101 | .expirationListener(expirationObserver) |
101 | // FIXME: make the expiration policy configurable. | 102 | // FIXME: make the expiration policy configurable. |
102 | .expirationPolicy(ExpirationPolicy.CREATED) | 103 | .expirationPolicy(ExpirationPolicy.CREATED) |
103 | .build()); | 104 | .build()); |
105 | + */ | ||
104 | } | 106 | } |
105 | } | 107 | } |
106 | 108 | ||
... | @@ -109,6 +111,7 @@ public class DatabaseUpdateEventHandler implements | ... | @@ -109,6 +111,7 @@ public class DatabaseUpdateEventHandler implements |
109 | tableEntryExpirationMap.remove(tableName); | 111 | tableEntryExpirationMap.remove(tableName); |
110 | } | 112 | } |
111 | 113 | ||
114 | + /* | ||
112 | private class ExpirationObserver implements ExpirationListener<DatabaseRow, Void> { | 115 | private class ExpirationObserver implements ExpirationListener<DatabaseRow, Void> { |
113 | @Override | 116 | @Override |
114 | public void expired(DatabaseRow key, Void value) { | 117 | public void expired(DatabaseRow key, Void value) { |
... | @@ -128,6 +131,7 @@ public class DatabaseUpdateEventHandler implements | ... | @@ -128,6 +131,7 @@ public class DatabaseUpdateEventHandler implements |
128 | } | 131 | } |
129 | } | 132 | } |
130 | } | 133 | } |
134 | + */ | ||
131 | 135 | ||
132 | @Override | 136 | @Override |
133 | public void handle(LeaderElectEvent event) { | 137 | public void handle(LeaderElectEvent event) { | ... | ... |
-
Please register or login to post a comment