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
d0f20e90
Commit
d0f20e90
authored
May 19, 2016
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #590 from guusdk/OF-1125
OF-1125: StreamID should be Cacheable.
parents
baa79d57
df5db065
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
BasicStreamIDFactory.java
...a/org/jivesoftware/openfire/spi/BasicStreamIDFactory.java
+14
-1
No files found.
src/java/org/jivesoftware/openfire/spi/BasicStreamIDFactory.java
View file @
d0f20e90
...
...
@@ -23,6 +23,9 @@ package org.jivesoftware.openfire.spi;
import
org.apache.commons.lang.StringEscapeUtils
;
import
org.jivesoftware.openfire.StreamID
;
import
org.jivesoftware.openfire.StreamIDFactory
;
import
org.jivesoftware.util.cache.CacheSizes
;
import
org.jivesoftware.util.cache.Cacheable
;
import
org.jivesoftware.util.cache.CannotCalculateSizeException
;
import
java.math.BigInteger
;
import
java.security.SecureRandom
;
...
...
@@ -54,7 +57,7 @@ public class BasicStreamIDFactory implements StreamIDFactory {
return
new
BasicStreamID
(
name
);
}
private
static
class
BasicStreamID
implements
StreamID
{
private
static
class
BasicStreamID
implements
StreamID
,
Cacheable
{
String
id
;
public
BasicStreamID
(
String
id
)
{
...
...
@@ -86,5 +89,15 @@ public class BasicStreamIDFactory implements StreamIDFactory {
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
()
)
return
false
;
return
id
.
equals
(
((
BasicStreamID
)
o
).
id
);
}
@Override
public
int
getCachedSize
()
throws
CannotCalculateSizeException
{
// Approximate the size of the object in bytes by calculating the size of each field.
int
size
=
0
;
size
+=
CacheSizes
.
sizeOfObject
();
// overhead of object
size
+=
CacheSizes
.
sizeOfString
(
id
);
// id
return
size
;
}
}
}
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