Always execute two times

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

User avatar
Wei
Posts: 50
Joined: 13 Jun 2017, 08:16

Always execute two times

Postby Wei » 26 Jul 2017, 09:30

My code

Code: Select all

private void SaveSessionInfo(ISession session,String... info)
    {
        ISFSObject userdata = new SFSObject();
        trace("info0:" + info[0]);
        trace("info1:" + info[1]);
        trace("info2:" + info[2]);
        userdata.putUtfString("openid", info[0]);
        userdata.putUtfString("nickname", info[1]);
        userdata.putUtfString("headurl", info[2]);
   
        session.setProperty("userdata", userdata);
    }


Error messages on console

Code: Select all

17:31:51,028 INFO  [SFSWorker:Ext:4] Extensions     - {LobbyExtension}: info0:null
17:31:51,028 INFO  [SFSWorker:Ext:4] Extensions     - {LobbyExtension}: info1:null
17:31:51,028 INFO  [SFSWorker:Ext:4] Extensions     - {LobbyExtension}: info2:null
17:31:51,029 WARN  [SFSWorker:Ext:4] managers.SFSExtensionManager     - java.lang.IllegalArgumentException:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: java.lang.IllegalArgumentException
Message: SFSObject requires a non-null value! If you need to add a null use the putNull() method.
Description: Error during event handling: java.lang.IllegalArgumentException: SFSObject requires a non-null value! If you need to add a null use the putNull() method., Listener: { Ext: LobbyExtension, Type: JAVA, Lev: ZONE, { Zone: Mazing }, {} }
+--- --- ---+
Stack Trace:
+--- --- ---+
com.smartfoxserver.v2.entities.data.SFSObject.putObj(SFSObject.java:701)
com.smartfoxserver.v2.entities.data.SFSObject.putUtfString(SFSObject.java:656)
com.mazingtec.lobbyextension.OnLogin.SaveSessionInfo(OnLogin.java:314)
com.mazingtec.lobbyextension.OnLogin.handleServerEvent(OnLogin.java:64)
com.smartfoxserver.v2.extensions.SFSExtension.handleServerEvent(SFSExtension.java:259)
com.smartfoxserver.v2.entities.managers.SFSExtensionManager.dispatchEvent(SFSExtensionManager.java:768)
com.smartfoxserver.v2.entities.managers.SFSExtensionManager.dispatchZoneLevelEvent(SFSExtensionManager.java:689)
com.smartfoxserver.v2.entities.managers.SFSExtensionManager.handleServerEvent(SFSExtensionManager.java:887)
com.smartfoxserver.v2.core.SFSEventManager$SFSEventRunner.run(SFSEventManager.java:65)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

17:31:51,619 INFO  [SFSWorker:Ext:2] Extensions     - {LobbyExtension}: info0:oVH8Gv1J_Dc34JGRO15IBeXSKnFA
17:31:51,620 INFO  [SFSWorker:Ext:2] Extensions     - {LobbyExtension}: info1:Jason
17:31:51,620 INFO  [SFSWorker:Ext:2] Extensions     - {LobbyExtension}: info2:http://wx.qlogo.cn/mmopen/ajNVdqHZLLDnao37NWN3sOwm1YE0snqjgzqfX4qE5T8ZIicA8IveB0escgibOQ9GBMa2BupowPWe4QDmeBwWtQ0A/0


As you can see, the 1st time, there was no data at all, but the 2nd time was right, but I only called SaveSessionInfo once
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Always execute two times

Postby Lapo » 26 Jul 2017, 09:37

You can see in the logs that the two calls are made by two different threads: SFSWorker:Ext:4, and SFSWorker:Ext:2 in rapid succession.
This means something else (the client?) has sent two requests.

Also the fact that the two calls used different parameters definitely suggests that they are two separate invocations.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Wei
Posts: 50
Joined: 13 Jun 2017, 08:16

Re: Always execute two times

Postby Wei » 26 Jul 2017, 09:44

My bad, something wrong with my android plugin, LoginRequest was called twice.

Thanks man.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Stevenor, Thomasea and 76 guests