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();
} }
/** /**
...@@ -65,12 +59,16 @@ public class ClearspaceVCardProvider implements VCardProvider { ...@@ -65,12 +59,16 @@ 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) { if (!fieldsIDLoaded) {
// try to load them synchronized (this) {
loadDefaultProfileFields(); if (!fieldsIDLoaded) {
// if still not loaded then the operation could no be perform // try to load them
if (!fieldsIDLoaded) { loadDefaultProfileFields();
// It is not supported exception, wrap it into an UnsupportedOperationException // if still not loaded then the operation could no be perform
throw new UnsupportedOperationException("Error loading the profiles IDs"); if (!fieldsIDLoaded) {
// It is not supported exception, wrap it into an UnsupportedOperationException
throw new UnsupportedOperationException("Error loading the profiles IDs");
}
}
} }
} }
...@@ -145,9 +143,13 @@ public class ClearspaceVCardProvider implements VCardProvider { ...@@ -145,9 +143,13 @@ public class ClearspaceVCardProvider implements VCardProvider {
*/ */
private boolean isAvatarReadOnly() { private boolean isAvatarReadOnly() {
if (avatarReadOnly == null) { if (avatarReadOnly == null) {
loadAvatarReadOnly(); synchronized (this) {
if (avatarReadOnly == null) {
loadAvatarReadOnly();
}
}
} }
return avatarReadOnly; return avatarReadOnly == null ? false : avatarReadOnly;
} }
/** /**
...@@ -170,10 +172,16 @@ public class ClearspaceVCardProvider implements VCardProvider { ...@@ -170,10 +172,16 @@ public class ClearspaceVCardProvider implements VCardProvider {
} }
if (!fieldsIDLoaded) { if (!fieldsIDLoaded) {
loadDefaultProfileFields(); synchronized (this) {
if (!fieldsIDLoaded) { if (!fieldsIDLoaded) {
// It is not supported exception, wrap it into an UnsupportedOperationException // try to load them
throw new UnsupportedOperationException("Error loading the profiles IDs"); loadDefaultProfileFields();
// if still not loaded then the operation could no be perform
if (!fieldsIDLoaded) {
// It is not supported exception, wrap it into an UnsupportedOperationException
throw new UnsupportedOperationException("Error loading the profiles IDs");
}
}
} }
} }
......
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