1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-09 17:02:53 +00:00

Change-Id: Ifa069a09d1b603781a2c9255d89b77cd6f25a359

This commit is contained in:
rogiel
2011-04-28 22:53:11 -03:00
parent 05e8355aaf
commit 54ef3c7fa2
38 changed files with 962 additions and 99 deletions

View File

@@ -1,8 +0,0 @@
package com.l2jserver.service.game.world;
import com.l2jserver.model.world.AbstractObject;
import com.l2jserver.model.world.event.WorldEvent;
public interface WorldEventDispatcher {
void dispatch(AbstractObject object, WorldEvent event);
}

View File

@@ -1,16 +1,13 @@
package com.l2jserver.service.game.world;
import java.util.Iterator;
import java.util.Set;
import com.l2jserver.model.world.WorldObject;
import com.l2jserver.model.world.filter.WorldFilter;
import com.l2jserver.model.world.filter.WorldObjectFilter;
import com.l2jserver.service.ServiceStartException;
import com.l2jserver.service.ServiceStopException;
public class WorldServiceImpl implements WorldService {
private Set<WorldObject> objects;
@Override
public void start() throws ServiceStartException {
// TODO Auto-generated method stub
@@ -31,14 +28,15 @@ public class WorldServiceImpl implements WorldService {
@Override
public Iterator<WorldObject> iterator() {
return objects.iterator();
}
public <T extends WorldObject> Iterator<T> iterator(WorldFilter<T> filter) {
//return objects.iterator();
// return objects.iterator();
return null;
}
public <T extends WorldObject> Iterator<T> iterator(WorldObjectFilter<T> filter) {
// return objects.iterator();
return null;
}
@Override
public void stop() throws ServiceStopException {
// TODO Auto-generated method stub

View File

@@ -1,10 +1,18 @@
package com.l2jserver.service.network;
import java.util.concurrent.Executors;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ServerChannel;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
import com.google.inject.Inject;
import com.l2jserver.service.configuration.ConfigurationService;
public class NettyNetworkService implements NetworkService {
private final NetworkConfiguration config;
private ServerBootstrap server;
private ServerChannel channel;
@Inject
public NettyNetworkService(ConfigurationService configService) {
@@ -13,11 +21,19 @@ public class NettyNetworkService implements NetworkService {
@Override
public void start() {
server = new ServerBootstrap(new NioServerSocketChannelFactory(
Executors.newCachedThreadPool(),
Executors.newCachedThreadPool()));
channel = (ServerChannel) server.bind(config.getListenAddress());
}
@Override
public void stop() {
try {
channel.close().awaitUninterruptibly();
} finally {
server = null;
channel = null;
}
}
}