Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
8a0351e9
Commit
8a0351e9
authored
Oct 26, 2017
by
Greg Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-1416: Ensure that hazelcast cache entries expire correctly
parent
9cf89f04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
ClusteredCache.java
...vesoftware/openfire/plugin/util/cache/ClusteredCache.java
+5
-2
ClusteredCacheFactory.java
...are/openfire/plugin/util/cache/ClusteredCacheFactory.java
+1
-1
No files found.
src/plugins/hazelcast/src/java/org/jivesoftware/openfire/plugin/util/cache/ClusteredCache.java
View file @
8a0351e9
...
...
@@ -44,6 +44,7 @@ public class ClusteredCache implements Cache {
* The map is used for distributed operations such as get, put, etc.
*/
protected
IMap
map
;
private
final
int
hazelcastLifetimeInSeconds
;
private
String
name
;
private
long
numberOfGets
=
0
;
...
...
@@ -52,9 +53,11 @@ public class ClusteredCache implements Cache {
*
* @param name a name for the cache, which should be unique per vm.
* @param cache the cache implementation
* @param hazelcastLifetimeInSeconds the lifetime of cache entries
*/
protected
ClusteredCache
(
String
name
,
IMap
cache
)
{
protected
ClusteredCache
(
String
name
,
IMap
cache
,
final
int
hazelcastLifetimeInSeconds
)
{
map
=
cache
;
this
.
hazelcastLifetimeInSeconds
=
hazelcastLifetimeInSeconds
;
setName
(
name
);
}
...
...
@@ -81,7 +84,7 @@ public class ClusteredCache implements Cache {
public
Object
put
(
Object
key
,
Object
object
)
{
if
(
object
==
null
)
{
return
null
;
}
return
map
.
put
(
key
,
object
);
return
map
.
put
(
key
,
object
,
hazelcastLifetimeInSeconds
,
TimeUnit
.
SECONDS
);
}
public
Object
get
(
Object
key
)
{
...
...
src/plugins/hazelcast/src/java/org/jivesoftware/openfire/plugin/util/cache/ClusteredCacheFactory.java
View file @
8a0351e9
...
...
@@ -222,7 +222,7 @@ public class ClusteredCacheFactory implements CacheFactoryStrategy {
final
MapConfig
mapConfig
=
hazelcast
.
getConfig
().
getMapConfig
(
name
);
mapConfig
.
setTimeToLiveSeconds
(
hazelcastLifetimeInSeconds
);
mapConfig
.
setMaxSizeConfig
(
new
MaxSizeConfig
(
hazelcastMaxCacheSize
,
MaxSizeConfig
.
MaxSizePolicy
.
USED_HEAP_SIZE
));
return
new
ClusteredCache
(
name
,
hazelcast
.
getMap
(
name
));
return
new
ClusteredCache
(
name
,
hazelcast
.
getMap
(
name
)
,
hazelcastLifetimeInSeconds
);
}
public
void
destroyCache
(
Cache
cache
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment