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
5f89a1ad
Unverified
Commit
5f89a1ad
authored
Nov 13, 2017
by
Dave Cridland
Committed by
GitHub
Nov 13, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #913 from guusdk/OF-1424_Group-CME
OF-1424: Use weakly consistent impl to prevent CME.
parents
22e0fd0a
a9fca53c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
Group.java
src/java/org/jivesoftware/openfire/group/Group.java
+18
-17
No files found.
src/java/org/jivesoftware/openfire/group/Group.java
View file @
5f89a1ad
...
...
@@ -28,6 +28,7 @@ import java.util.HashSet;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentSkipListSet
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.event.GroupEventDispatcher
;
...
...
@@ -62,8 +63,8 @@ public class Group implements Cacheable, Externalizable {
private
String
name
;
private
String
description
;
private
Set
<
JID
>
members
;
private
Set
<
JID
>
administrators
;
private
ConcurrentSkipList
Set
<
JID
>
members
;
private
ConcurrentSkipList
Set
<
JID
>
administrators
;
/**
* Constructor added for Externalizable. Do not use this constructor.
...
...
@@ -74,7 +75,7 @@ public class Group implements Cacheable, Externalizable {
/**
* Constructs a new group. Note: this constructor is intended for implementors of the
* {@link GroupProvider} interface. To create a new group, use the
* {@link GroupManager#createGroup(String)} method.
* {@link GroupManager#createGroup(String)} method.
*
* @param name the name.
* @param description the description.
...
...
@@ -88,8 +89,8 @@ public class Group implements Cacheable, Externalizable {
this
.
provider
=
groupManager
.
getProvider
();
this
.
name
=
name
;
this
.
description
=
description
;
this
.
members
=
new
Hash
Set
<>(
members
);
this
.
administrators
=
new
Hash
Set
<>(
administrators
);
this
.
members
=
new
ConcurrentSkipList
Set
<>(
members
);
this
.
administrators
=
new
ConcurrentSkipList
Set
<>(
administrators
);
}
/**
...
...
@@ -110,11 +111,11 @@ public class Group implements Cacheable, Externalizable {
this
.
provider
=
groupManager
.
getProvider
();
this
.
name
=
name
;
this
.
description
=
description
;
this
.
members
=
new
Hash
Set
<>(
members
);
this
.
administrators
=
new
Hash
Set
<>(
administrators
);
this
.
members
=
new
ConcurrentSkipList
Set
<>(
members
);
this
.
administrators
=
new
ConcurrentSkipList
Set
<>(
administrators
);
this
.
properties
=
provider
.
loadProperties
(
this
);
// Apply the given properties to the group
for
(
Map
.
Entry
<
String
,
String
>
property
:
properties
.
entrySet
())
{
if
(!
property
.
getValue
().
equals
(
this
.
properties
.
get
(
property
.
getKey
())))
{
...
...
@@ -134,7 +135,7 @@ public class Group implements Cacheable, Externalizable {
* Returns a JID for the group based on the group name. This
* instance will be of class GroupJID to distinguish it from
* other types of JIDs in the system.
*
*
* This method is synchronized to ensure each group has only
* a single JID instance created via lazy instantiation.
*
...
...
@@ -288,7 +289,7 @@ public class Group implements Cacheable, Externalizable {
* @return true if the specified user is a group user.
*/
public
boolean
isUser
(
JID
user
)
{
// Make sure that we are always checking bare JIDs
// Make sure that we are always checking bare JIDs
if
(
user
!=
null
&&
user
.
getResource
()
!=
null
)
{
user
=
user
.
asBareJID
();
}
...
...
@@ -502,16 +503,16 @@ public class Group implements Cacheable, Externalizable {
if
(
ExternalizableUtil
.
getInstance
().
readBoolean
(
in
))
{
description
=
ExternalizableUtil
.
getInstance
().
readSafeUTF
(
in
);
}
members
=
new
Hash
Set
<>();
administrators
=
new
Hash
Set
<>();
members
=
new
ConcurrentSkipList
Set
<>();
administrators
=
new
ConcurrentSkipList
Set
<>();
ExternalizableUtil
.
getInstance
().
readSerializableCollection
(
in
,
members
,
getClass
().
getClassLoader
());
ExternalizableUtil
.
getInstance
().
readSerializableCollection
(
in
,
administrators
,
getClass
().
getClassLoader
());
}
/**
* Search for a JID within a group. If the given haystack is not resolvable
* to a group, this method returns false.
*
*
* @param needle A JID, possibly a member/admin of the given group
* @param haystack Presumably a Group, a Group name, or a JID that represents a Group
* @return true if the JID (needle) is found in the group (haystack)
...
...
@@ -520,10 +521,10 @@ public class Group implements Cacheable, Externalizable {
Group
group
=
resolveFrom
(
haystack
);
return
(
group
!=
null
&&
group
.
isUser
(
needle
));
}
/**
* Attempt to resolve the given object into a Group.
*
*
* @param proxy Presumably a Group, a Group name, or a JID that represents a Group
* @return The corresponding group, or null if the proxy cannot be resolved as a group
*/
...
...
@@ -543,5 +544,5 @@ public class Group implements Cacheable, Externalizable {
}
return
result
;
}
}
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