Commit 60f49693 authored by Gabriel Guardincerri's avatar Gabriel Guardincerri Committed by gguardin

Removed initial loads, and sync them

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches/openfire_3_5_0@10024 b35dd754-fafc-0310-a699-88a17e54d16e
parent bdae6425
...@@ -47,12 +47,6 @@ public class ClearspaceVCardProvider implements VCardProvider { ...@@ -47,12 +47,6 @@ public class ClearspaceVCardProvider implements VCardProvider {
public ClearspaceVCardProvider() { public ClearspaceVCardProvider() {
this.manager = ClearspaceManager.getInstance(); this.manager = ClearspaceManager.getInstance();
// Tries to load the avatar read only information
loadAvatarReadOnly();
// Tries to load the default profile fields
loadDefaultProfileFields();
} }
/** /**
...@@ -64,6 +58,8 @@ public class ClearspaceVCardProvider implements VCardProvider { ...@@ -64,6 +58,8 @@ public class ClearspaceVCardProvider implements VCardProvider {
*/ */
public Element loadVCard(String username) { public Element loadVCard(String username) {
// if the fields id are not loaded // if the fields id are not loaded
if (!fieldsIDLoaded) {
synchronized (this) {
if (!fieldsIDLoaded) { if (!fieldsIDLoaded) {
// try to load them // try to load them
loadDefaultProfileFields(); loadDefaultProfileFields();
...@@ -73,6 +69,8 @@ public class ClearspaceVCardProvider implements VCardProvider { ...@@ -73,6 +69,8 @@ public class ClearspaceVCardProvider implements VCardProvider {
throw new UnsupportedOperationException("Error loading the profiles IDs"); throw new UnsupportedOperationException("Error loading the profiles IDs");
} }
} }
}
}
try { try {
...@@ -144,10 +142,14 @@ public class ClearspaceVCardProvider implements VCardProvider { ...@@ -144,10 +142,14 @@ public class ClearspaceVCardProvider implements VCardProvider {
* @return if the Avatar of Clearspace can be modified. * @return if the Avatar of Clearspace can be modified.
*/ */
private boolean isAvatarReadOnly() { private boolean isAvatarReadOnly() {
if (avatarReadOnly == null) {
synchronized (this) {
if (avatarReadOnly == null) { if (avatarReadOnly == null) {
loadAvatarReadOnly(); loadAvatarReadOnly();
} }
return avatarReadOnly; }
}
return avatarReadOnly == null ? false : avatarReadOnly;
} }
/** /**
...@@ -170,12 +172,18 @@ public class ClearspaceVCardProvider implements VCardProvider { ...@@ -170,12 +172,18 @@ public class ClearspaceVCardProvider implements VCardProvider {
} }
if (!fieldsIDLoaded) { if (!fieldsIDLoaded) {
synchronized (this) {
if (!fieldsIDLoaded) {
// try to load them
loadDefaultProfileFields(); loadDefaultProfileFields();
// if still not loaded then the operation could no be perform
if (!fieldsIDLoaded) { if (!fieldsIDLoaded) {
// It is not supported exception, wrap it into an UnsupportedOperationException // It is not supported exception, wrap it into an UnsupportedOperationException
throw new UnsupportedOperationException("Error loading the profiles IDs"); throw new UnsupportedOperationException("Error loading the profiles IDs");
} }
} }
}
}
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment