BuddyList thread safety

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
Stigma
Posts: 15
Joined: 22 Feb 2010, 13:30
Location: Switzerland

BuddyList thread safety

Post by Stigma »

Hi,

In my application I use a custom buddy persister. For adding a buddy I call the addBuddy() method from the client side. But to ban a user I use a custom method that sends a JSONObject directly to the extension handler. This is the essential part of my ban method :
BuddyListManager bm = SmartFoxServer.getInstance().getZone(CoreExt.zoneName).getBuddyManager();

bm.setMutualAddBuddy(false);
bm.addBuddy(commanderName, bannedCommanderName);
bm.setMutualAddBuddy(true);
bm.setBuddyBlockStatus(user, bannedCommanderName, true);
As you can see I set the mutual add buddy to false to avoid the permission request because it isn't needed for banning. After the ban is performed I set to true the mutual add buddy.

I wonder if the BuddyListManager is threadsafe and if it's possible for a user to add a buddy when the permission is set to false. I hope it's the same thread server-side that handles the request from the client sent by methods sendXtMessage() and addBuddy().

Thanks for your answer.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Yes the BuddyManager is thread safe, but instead of calling those methods directly you should start from the ExtensionHelper's methods.
and if it's possible for a user to add a buddy when the permission is set to false
I am not sure about what you mean here? An example?
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply