This commit is contained in:
wentch
2016-01-27 14:09:07 +08:00
parent f34623a5c9
commit 6b0247ae7f
2 changed files with 5 additions and 3 deletions

View File

@@ -149,6 +149,7 @@ public class SncpTest {
{
setName("Thread-Server-01");
}
@Override
public void run() {
try {
@@ -157,7 +158,7 @@ public class SncpTest {
if (port2 > 0) set.add(new InetSocketAddress(myhost, port2));
//String name, WatchFactory, ObjectPool<ByteBuffer>, AsynchronousChannelGroup, InetSocketAddress clientAddress, Collection<InetSocketAddress>
final Transport transport = new Transport("", WatchFactory.root(), newBufferPool(), newChannelGroup(), null, set);
SncpTestService service = Sncp.createLocalService("", null, SncpTestService.class, addr, transport, null);
SncpTestService service = Sncp.createLocalService("", null, ResourceFactory.root(), SncpTestService.class, addr, transport, null);
ResourceFactory.root().inject(service);
server.addService(new ServiceWrapper(SncpTestService.class, service, "", "", new HashSet<>(), null));
System.out.println(service);
@@ -182,6 +183,7 @@ public class SncpTest {
{
setName("Thread-Server-02");
}
@Override
public void run() {
try {
@@ -190,7 +192,7 @@ public class SncpTest {
set.add(new InetSocketAddress(myhost, port));
//String name, WatchFactory, ObjectPool<ByteBuffer>, AsynchronousChannelGroup, InetSocketAddress clientAddress, Collection<InetSocketAddress>
final Transport transport = new Transport("", WatchFactory.root(), newBufferPool(), newChannelGroup(), null, set);
Service service = Sncp.createLocalService("", null, SncpTestService.class, addr, transport, null);
Service service = Sncp.createLocalService("", null, ResourceFactory.root(), SncpTestService.class, addr, transport, null);
server.addService(new ServiceWrapper(SncpTestService.class, service, "", "", new HashSet<>(), null));
AnyValue.DefaultAnyValue conf = new AnyValue.DefaultAnyValue();
conf.addValue("host", "0.0.0.0");

View File

@@ -70,7 +70,7 @@ public class SncpTestService implements SncpTestIService {
}
public static void main(String[] args) throws Exception {
Service service = Sncp.createLocalService("", null, SncpTestService.class, new InetSocketAddress("127.0.0.1", 7070), null, null);
Service service = Sncp.createLocalService("", null, ResourceFactory.root(), SncpTestService.class, new InetSocketAddress("127.0.0.1", 7070), null, null);
for (Method method : service.getClass().getDeclaredMethods()) {
System.out.println(method);
}