Java 类com.esotericsoftware.kryonet.FrameworkMessage.RegisterTCP 实例源码

项目:EsperDist    文件:KryoSerialization.java   
public KryoSerialization (Kryo kryo) {
    this.kryo = kryo;

    kryo.register(RegisterTCP.class);
    kryo.register(RegisterUDP.class);
    kryo.register(KeepAlive.class);
    kryo.register(DiscoverHost.class);
    kryo.register(Ping.class);

    input = new Input(byteBufferInputStream, 512);
    output = new Output(byteBufferOutputStream, 512);
}
项目:EsperDist    文件:Server.java   
private void acceptOperation (SocketChannel socketChannel) {
    Connection connection = newConnection();
    connection.initialize(serialization, writeBufferSize, objectBufferSize);
    connection.endPoint = this;
    UdpConnection udp = this.udp;
    if (udp != null) connection.udp = udp;
    try {
        SelectionKey selectionKey = connection.tcp.accept(selector, socketChannel);
        selectionKey.attach(connection);

        int id = nextConnectionID++;
        if (nextConnectionID == -1) nextConnectionID = 1;
        connection.id = id;
        connection.setConnected(true);
        connection.addListener(dispatchListener);

        if (udp == null)
            addConnection(connection);
        else
            pendingConnections.put(id, connection);

        RegisterTCP registerConnection = new RegisterTCP();
        registerConnection.connectionID = id;
        connection.sendTCP(registerConnection);

        if (udp == null) connection.notifyConnected();
    } catch (IOException ex) {
        connection.close();
        if (DEBUG) debug("kryonet", "Unable to accept TCP connection.", ex);
    }
}
项目:EsperDist    文件:JsonSerialization.java   
public JsonSerialization () {
    json.addClassTag("RegisterTCP", RegisterTCP.class);
    json.addClassTag("RegisterUDP", RegisterUDP.class);
    json.addClassTag("KeepAlive", KeepAlive.class);
    json.addClassTag("DiscoverHost", DiscoverHost.class);
    json.addClassTag("Ping", Ping.class);

    json.setWriter(writer);
}
项目:EsperDist    文件:KryoSerialization.java   
public KryoSerialization (Kryo kryo) {
    this.kryo = kryo;

    kryo.register(RegisterTCP.class);
    kryo.register(RegisterUDP.class);
    kryo.register(KeepAlive.class);
    kryo.register(DiscoverHost.class);
    kryo.register(Ping.class);

    input = new Input(byteBufferInputStream, 512);
    output = new Output(byteBufferOutputStream, 512);
}
项目:EsperDist    文件:Server.java   
private void acceptOperation (SocketChannel socketChannel) {
    Connection connection = newConnection();
    connection.initialize(serialization, writeBufferSize, objectBufferSize);
    connection.endPoint = this;
    UdpConnection udp = this.udp;
    if (udp != null) connection.udp = udp;
    try {
        SelectionKey selectionKey = connection.tcp.accept(selector, socketChannel);
        selectionKey.attach(connection);

        int id = nextConnectionID++;
        if (nextConnectionID == -1) nextConnectionID = 1;
        connection.id = id;
        connection.setConnected(true);
        connection.addListener(dispatchListener);

        if (udp == null)
            addConnection(connection);
        else
            pendingConnections.put(id, connection);

        RegisterTCP registerConnection = new RegisterTCP();
        registerConnection.connectionID = id;
        connection.sendTCP(registerConnection);

        if (udp == null) connection.notifyConnected();
    } catch (IOException ex) {
        connection.close();
        if (DEBUG) debug("kryonet", "Unable to accept TCP connection.", ex);
    }
}
项目:EsperDist    文件:JsonSerialization.java   
public JsonSerialization () {
    json.addClassTag("RegisterTCP", RegisterTCP.class);
    json.addClassTag("RegisterUDP", RegisterUDP.class);
    json.addClassTag("KeepAlive", KeepAlive.class);
    json.addClassTag("DiscoverHost", DiscoverHost.class);
    json.addClassTag("Ping", Ping.class);

    json.setWriter(writer);
}
项目:magic-realm    文件:KryoSerialization.java   
public KryoSerialization (Kryo kryo) {
    this.kryo = kryo;

    kryo.register(RegisterTCP.class);
    kryo.register(RegisterUDP.class);
    kryo.register(KeepAlive.class);
    kryo.register(DiscoverHost.class);
    kryo.register(Ping.class);

    input = new ByteBufferInput();
    output = new ByteBufferOutput();
}
项目:magic-realm    文件:Server.java   
private void acceptOperation (SocketChannel socketChannel) {
    Connection connection = newConnection();
    connection.initialize(serialization, writeBufferSize, objectBufferSize);
    connection.endPoint = this;
    UdpConnection udp = this.udp;
    if (udp != null) connection.udp = udp;
    try {
        SelectionKey selectionKey = connection.tcp.accept(selector, socketChannel);
        selectionKey.attach(connection);

        int id = nextConnectionID++;
        if (nextConnectionID == -1) nextConnectionID = 1;
        connection.id = id;
        connection.setConnected(true);
        connection.addListener(dispatchListener);

        if (udp == null)
            addConnection(connection);
        else
            pendingConnections.put(id, connection);

        RegisterTCP registerConnection = new RegisterTCP();
        registerConnection.connectionID = id;
        connection.sendTCP(registerConnection);

        if (udp == null) connection.notifyConnected();
    } catch (IOException ex) {
        connection.close();
        if (DEBUG) debug("kryonet", "Unable to accept TCP connection.", ex);
    }
}
项目:magic-realm    文件:JsonSerialization.java   
public JsonSerialization () {
    json.addClassTag("RegisterTCP", RegisterTCP.class);
    json.addClassTag("RegisterUDP", RegisterUDP.class);
    json.addClassTag("KeepAlive", KeepAlive.class);
    json.addClassTag("DiscoverHost", DiscoverHost.class);
    json.addClassTag("Ping", Ping.class);

    json.setWriter(writer);
}
项目:flume2storm    文件:MyKryoSerialization.java   
public MyKryoSerialization(Kryo kryo, int objectSize) {
  this.kryo = kryo;

  kryo.register(RegisterTCP.class);
  kryo.register(RegisterUDP.class);
  kryo.register(KeepAlive.class);
  kryo.register(DiscoverHost.class);
  kryo.register(Ping.class);

  input = new Input(byteBufferInputStream, objectSize);
  output = new Output(byteBufferOutputStream, objectSize);
}
项目:kingdom    文件:KryoSerialization.java   
public KryoSerialization (Kryo kryo) {
    this.kryo = kryo;

    kryo.register(RegisterTCP.class);
    kryo.register(RegisterUDP.class);
    kryo.register(KeepAlive.class);
    kryo.register(DiscoverHost.class);
    kryo.register(Ping.class);

    input = new Input(byteBufferInputStream, 512);
    output = new Output(byteBufferOutputStream, 512);
}
项目:kingdom    文件:Server.java   
private void acceptOperation (SocketChannel socketChannel) {
    Connection connection = newConnection();
    connection.initialize(serialization, writeBufferSize, objectBufferSize);
    connection.endPoint = this;
    UdpConnection udp = this.udp;
    if (udp != null) connection.udp = udp;
    try {
        SelectionKey selectionKey = connection.tcp.accept(selector, socketChannel);
        selectionKey.attach(connection);

        int id = nextConnectionID++;
        if (nextConnectionID == -1) nextConnectionID = 1;
        connection.id = id;
        connection.setConnected(true);
        connection.addListener(dispatchListener);

        if (udp == null)
            addConnection(connection);
        else
            pendingConnections.put(id, connection);

        RegisterTCP registerConnection = new RegisterTCP();
        registerConnection.connectionID = id;
        connection.sendTCP(registerConnection);

        if (udp == null) connection.notifyConnected();
    } catch (IOException ex) {
        connection.close();
        if (DEBUG) debug("kryonet", "Unable to accept TCP connection.", ex);
    }
}
项目:kingdom    文件:JsonSerialization.java   
public JsonSerialization () {
    json.addClassTag("RegisterTCP", RegisterTCP.class);
    json.addClassTag("RegisterUDP", RegisterUDP.class);
    json.addClassTag("KeepAlive", KeepAlive.class);
    json.addClassTag("DiscoverHost", DiscoverHost.class);
    json.addClassTag("Ping", Ping.class);

    json.setWriter(writer);
}
项目:the-erder    文件:KryoSerialization.java   
public KryoSerialization(Kryo kryo) {
    this.kryo = kryo;

    kryo.register(RegisterTCP.class);
    kryo.register(RegisterUDP.class);
    kryo.register(KeepAlive.class);
    kryo.register(DiscoverHost.class);
    kryo.register(Ping.class);

    input = new ByteBufferInput();
    output = new ByteBufferOutput();
}
项目:the-erder    文件:Server.java   
private void acceptOperation(SocketChannel socketChannel) {
    Connection connection = newConnection();
    connection.initialize(serialization, writeBufferSize, objectBufferSize);
    connection.endPoint = this;
    UdpConnection udp = this.udp;
    if (udp != null)
        connection.udp = udp;
    try {
        SelectionKey selectionKey = connection.tcp.accept(selector,
                socketChannel);
        selectionKey.attach(connection);

        int id = nextConnectionID++;
        if (nextConnectionID == -1)
            nextConnectionID = 1;
        connection.id = id;
        connection.setConnected(true);
        connection.addListener(dispatchListener);

        if (udp == null)
            addConnection(connection);
        else
            pendingConnections.put(id, connection);

        RegisterTCP registerConnection = new RegisterTCP();
        registerConnection.connectionID = id;
        connection.sendTCP(registerConnection);

        if (udp == null)
            connection.notifyConnected();
    } catch (IOException ex) {
        connection.close();
        if (DEBUG)
            debug("kryonet", "Unable to accept TCP connection.", ex);
    }
}
项目:the-erder    文件:JsonSerialization.java   
public JsonSerialization() {
    json.addClassTag("RegisterTCP", RegisterTCP.class);
    json.addClassTag("RegisterUDP", RegisterUDP.class);
    json.addClassTag("KeepAlive", KeepAlive.class);
    json.addClassTag("DiscoverHost", DiscoverHost.class);
    json.addClassTag("Ping", Ping.class);

    json.setWriter(writer);
}
项目:kryonet    文件:KryoSerialization.java   
public KryoSerialization (Kryo kryo) {
    this.kryo = kryo;

    kryo.register(RegisterTCP.class);
    kryo.register(RegisterUDP.class);
    kryo.register(KeepAlive.class);
    kryo.register(DiscoverHost.class);
    kryo.register(Ping.class);

    input = new ByteBufferInput();
    output = new ByteBufferOutput();
}
项目:kryonet    文件:Server.java   
private void acceptOperation (SocketChannel socketChannel) {
    Connection connection = newConnection();
    connection.initialize(serialization, writeBufferSize, objectBufferSize);
    connection.endPoint = this;
    UdpConnection udp = this.udp;
    if (udp != null) connection.udp = udp;
    try {
        SelectionKey selectionKey = connection.tcp.accept(selector, socketChannel);
        selectionKey.attach(connection);

        int id = nextConnectionID++;
        if (nextConnectionID == -1) nextConnectionID = 1;
        connection.id = id;
        connection.setConnected(true);
        connection.addListener(dispatchListener);

        if (udp == null)
            addConnection(connection);
        else
            pendingConnections.put(id, connection);

        RegisterTCP registerConnection = new RegisterTCP();
        registerConnection.connectionID = id;
        connection.sendTCP(registerConnection);

        if (udp == null) connection.notifyConnected();
    } catch (IOException ex) {
        connection.close();
        if (DEBUG) debug("kryonet", "Unable to accept TCP connection.", ex);
    }
}
项目:kryonet    文件:JsonSerialization.java   
public JsonSerialization () {
    json.addClassTag("RegisterTCP", RegisterTCP.class);
    json.addClassTag("RegisterUDP", RegisterUDP.class);
    json.addClassTag("KeepAlive", KeepAlive.class);
    json.addClassTag("DiscoverHost", DiscoverHost.class);
    json.addClassTag("Ping", Ping.class);

    json.setWriter(writer);
}
项目:RuinsOfRevenge    文件:KryoSerialization.java   
public KryoSerialization (Kryo kryo) {
    this.kryo = kryo;

    kryo.register(RegisterTCP.class);
    kryo.register(RegisterUDP.class);
    kryo.register(KeepAlive.class);
    kryo.register(DiscoverHost.class);
    kryo.register(Ping.class);

    input = new Input(byteBufferInputStream, 512);
    output = new Output(byteBufferOutputStream, 512);
}
项目:RuinsOfRevenge    文件:Server.java   
private void acceptOperation (SocketChannel socketChannel) {
    Connection connection = newConnection();
    connection.initialize(serialization, writeBufferSize, objectBufferSize);
    connection.endPoint = this;
    UdpConnection udp = this.udp;
    if (udp != null) connection.udp = udp;
    try {
        SelectionKey selectionKey = connection.tcp.accept(selector, socketChannel);
        selectionKey.attach(connection);

        int id = nextConnectionID++;
        if (nextConnectionID == -1) nextConnectionID = 1;
        connection.id = id;
        connection.setConnected(true);
        connection.addListener(dispatchListener);

        if (udp == null)
            addConnection(connection);
        else
            pendingConnections.put(id, connection);

        RegisterTCP registerConnection = new RegisterTCP();
        registerConnection.connectionID = id;
        connection.sendTCP(registerConnection);

        if (udp == null) connection.notifyConnected();
    } catch (IOException ex) {
        connection.close();
        if (DEBUG) debug("kryonet", "Unable to accept TCP connection.", ex);
    }
}
项目:RuinsOfRevenge    文件:JsonSerialization.java   
public JsonSerialization () {
    json.addClassTag("RegisterTCP", RegisterTCP.class);
    json.addClassTag("RegisterUDP", RegisterUDP.class);
    json.addClassTag("KeepAlive", KeepAlive.class);
    json.addClassTag("DiscoverHost", DiscoverHost.class);
    json.addClassTag("Ping", Ping.class);
}