All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.nadron.event.impl.EventDispatchers Maven / Gradle / Ivy

Go to download

Nadron is a high speed socket based java game server written using Netty and Mike Rettig's Jetlang. It is specifically tuned for network based multiplayer games and supports TCP and UDP network protocols.

There is a newer version: 0.7
Show newest version
package io.nadron.event.impl;

import io.nadron.app.GameRoom;
import io.nadron.concurrent.Fibers;
import io.nadron.concurrent.Lane;
import io.nadron.concurrent.LaneStrategy;
import io.nadron.event.Event;
import io.nadron.event.EventDispatcher;

import java.util.concurrent.ExecutorService;

import org.jetlang.channels.MemoryChannel;
import org.jetlang.fibers.Fiber;

public class EventDispatchers
{
	public static EventDispatcher newJetlangEventDispatcher(GameRoom room,
			LaneStrategy strategy)
	{
		Fiber fiber = null;
		JetlangEventDispatcher dispatcher = null;
		if (null == room)
		{
			fiber = Fibers.pooledFiber();
			dispatcher = new JetlangEventDispatcher(new MemoryChannel(),
					fiber, null);
		}
		else
		{
			Lane lane = strategy.chooseLane(room);
			fiber = Fibers.pooledFiber(lane);
			dispatcher = new JetlangEventDispatcher(new MemoryChannel(),
					fiber, lane);
		}
		dispatcher.initialize();

		return dispatcher;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy