Skip to content

Commit

Permalink
fixes #105: Reported cache max size
Browse files Browse the repository at this point in the history
The maximum cache size was reported by the ClusteredCache implementation incorrectly, when based on Openfire-provided configuration.

This change effectively reverts the value modifications performed by `org.jivesoftware.openfire.plugin.util.cache.ClusteredCacheFactory#createCache`
  • Loading branch information
guusdk committed Nov 5, 2024
1 parent 612c803 commit 3cc5171
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ <h1>

<p><b>3.0.1</b> -- (To be determined)</p>
<ul>
<li>[<a href='https://github.com/igniterealtime/openfire-hazelcast-plugin/issues/105'>Issue #105</a>] - Maximum cache size (in bytes) incorrectly reported</li>
<li>[<a href='https://github.com/igniterealtime/openfire-hazelcast-plugin/issues/103'>Issue #103</a>] - Fix Cluster initialization race condition</li>
<li>[<a href='https://github.com/igniterealtime/openfire-hazelcast-plugin/issues/102'>Issue #102</a>] - Remove unused code in ClusterListener</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<description>${project.description}</description>
<author>Ignite Realtime</author>
<version>${project.version}</version>
<date>2024-11-02</date>
<date>2024-11-05</date>
<minServerVersion>4.8.1</minServerVersion>
<minJavaVersion>1.8</minJavaVersion>
</plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@ public String getCacheSizeRemark() {

@Override
public long getMaxCacheSize() {
final int size = config.getEvictionConfig().getSize();
if (size == Integer.MAX_VALUE) {
return -1; // Hazelcast doesn't use negative values.
}

if (getCapacityUnit() != null && getCapacityUnit() == CapacityUnit.BYTES) {
return config.getEvictionConfig().getSize() * 1024 * 1024L; // Hazelcast stores this as megabyte, not byte.
}

return config.getEvictionConfig().getSize();
}

Expand Down

0 comments on commit 3cc5171

Please sign in to comment.