Page 1 of 1

init() function repeat more than one time at server start

Posted: 08 Dec 2007, 13:19
by mittico
Hi,
We are creating a new online games application.
I defined some properties, like gameType and buyIn.
gameType is an Enum class, buyIn an array of buyIns.
When i start the server i automatically create rooms iterating and nest iterating trough gameType and buyIns so that finally i create buyIn.size *
gameType.values().length number of rooms.

I done this on the init() function:

Code: Select all

		public void init()
		{
			
			//declare the instance of my extensionHelper
			helper = ExtensionHelper.instance();

			//initialize my zone
			z = helper.getZone("myRoom");
			
			//Initialize Zone's room
			startServer();
			// Traces the message to the AdminTool and to the console
			trace("Hi! The myServer Server is initializing");
		}
the startServer() function initialize all the server rooms like i said.

The init() is multirepeated randomly.
it's my mistake or a bug?
thx

Posted: 08 Dec 2007, 17:13
by patso
The init function is called only one time in the extension life cycle. If I understood you right init function is called more then once("multirepeated "). If this is the case this may be is caused because you edit the extension and AutoReloadExtensions is enabled then when you edit you extension its automatically loaded again and logically the init function is called again(as well as the destroy function btw).

Posted: 08 Dec 2007, 17:43
by mittico
If I understood you right init function is called more then once("multirepeated ")
yes.
If this is the case this may be is caused because you edit the extension
If you mean i'm creating new rooms at runtime the answer is yes.
AutoReloadExtensions is enabled then when you edit you extension its automatically loaded again
Yes it was enabled, i set it to false now and it show the same behaviour.

thx for your reply

problem solved

Posted: 08 Dec 2007, 19:12
by mittico
I found the answer to my problem on another post.
The trace function causes this problem,
I replaced it with system.out.println
bye.

Posted: 18 Dec 2007, 08:31
by Lapo
Could you explain what the problem was?
It may help other people as well.
thanks