Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Madan Jampani
2014-11-12 01:24:19 -0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3865cd9be54a558006879f6034d7980c7c558bc8
3865cd9b
1 parent
44e6a540
Disabling expiring map until the osgi issue is understood.
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
core/store/dist/pom.xml
core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseUpdateEventHandler.java
core/store/dist/pom.xml
View file @
3865cd9
...
...
@@ -103,12 +103,6 @@
<artifactId>
hazelcast
</artifactId>
</dependency>
<dependency>
<groupId>
net.jodah
</groupId>
<artifactId>
expiringmap
</artifactId>
<version>
0.3.1
</version>
</dependency>
<!-- for shaded copycat -->
<dependency>
<groupId>
org.onlab.onos
</groupId>
...
...
core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseUpdateEventHandler.java
View file @
3865cd9
...
...
@@ -20,12 +20,11 @@ import java.io.IOException;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
net.jodah.expiringmap.ExpiringMap
;
import
net.jodah.expiringmap.ExpiringMap.ExpirationListener
;
import
net.jodah.expiringmap.ExpiringMap.ExpirationPolicy
;
//
import net.jodah.expiringmap.ExpiringMap;
//
import net.jodah.expiringmap.ExpiringMap.ExpirationListener;
//
import net.jodah.expiringmap.ExpiringMap.ExpirationPolicy;
import
net.kuujo.copycat.cluster.Member
;
import
net.kuujo.copycat.event.EventHandler
;
import
net.kuujo.copycat.event.LeaderElectEvent
;
...
...
@@ -56,7 +55,7 @@ public class DatabaseUpdateEventHandler implements
private
final
Member
localMember
;
private
final
AtomicBoolean
isLocalMemberLeader
=
new
AtomicBoolean
(
false
);
private
final
Map
<
String
,
Map
<
DatabaseRow
,
Void
>>
tableEntryExpirationMap
=
new
HashMap
<>();
private
final
ExpirationListener
<
DatabaseRow
,
Void
>
expirationObserver
=
new
ExpirationObserver
();
//
private final ExpirationListener<DatabaseRow, Void> expirationObserver = new ExpirationObserver();
DatabaseUpdateEventHandler
(
Member
localMember
)
{
this
.
localMember
=
localMember
;
...
...
@@ -95,12 +94,15 @@ public class DatabaseUpdateEventHandler implements
// make this explicit instead of relying on a negative value
// to indicate no expiration.
if
(
expirationTimeMillis
>
0
)
{
tableEntryExpirationMap
.
put
(
tableName
,
ExpiringMap
.
builder
()
tableEntryExpirationMap
.
put
(
tableName
,
null
);
/*
ExpiringMap.builder()
.expiration(expirationTimeMillis, TimeUnit.SECONDS)
.expirationListener(expirationObserver)
// FIXME: make the expiration policy configurable.
.expirationPolicy(ExpirationPolicy.CREATED)
.build());
*/
}
}
...
...
@@ -109,6 +111,7 @@ public class DatabaseUpdateEventHandler implements
tableEntryExpirationMap
.
remove
(
tableName
);
}
/*
private class ExpirationObserver implements ExpirationListener<DatabaseRow, Void> {
@Override
public void expired(DatabaseRow key, Void value) {
...
...
@@ -128,6 +131,7 @@ public class DatabaseUpdateEventHandler implements
}
}
}
*/
@Override
public
void
handle
(
LeaderElectEvent
event
)
{
...
...
Please
register
or
login
to post a comment