Package org.vertx.java.core.net.impl

Examples of org.vertx.java.core.net.impl.ServerID


  @Override
  public void readData(DataInput dataInput) throws IOException {
    int port = dataInput.readInt();
    String host = dataInput.readUTF();
    serverID = new ServerID(port, host);
  }
View Full Code Here


    int hostLength = readBuff.getInt(pos);
    pos += 4;
    byte[] hostBytes = readBuff.getBytes(pos, pos + hostLength);
    pos += hostLength;
    String host = new String(hostBytes, CharsetUtil.UTF_8);
    sender = new ServerID(port, host);
    int replyAddressLength = readBuff.getInt(pos);
    pos += 4;
    if (replyAddressLength > 0) {
      byte[] replyAddressBytes = readBuff.getBytes(pos, pos + replyAddressLength);
      pos += replyAddressLength;
View Full Code Here

  private final ClusterManager clusterMgr;

  public DefaultEventBus(VertxInternal vertx) {
    // Just some dummy server ID
    this.vertx = vertx;
    this.serverID = new ServerID(-1, "localhost");
    this.server = null;
    this.subs = null;
    this.clusterMgr = null;
    ManagementRegistry.registerEventBus(serverID);
  }
View Full Code Here

    server.listen(port, hostName, new AsyncResultHandler<NetServer>() {
      @Override
      public void handle(AsyncResult<NetServer> asyncResult) {
        if (asyncResult.succeeded()) {
          // If using a wilcard port (0) then we ask the server for the actual port:
          DefaultEventBus.this.serverID = new ServerID(server.port(), hostName);
        }
        if (listenHandler != null) {
          if (asyncResult.succeeded()) {
            listenHandler.handle(new DefaultFutureResult<>((Void)null));
          } else {
View Full Code Here

  }

  private void sendToSubs(ServerIDs subs, BaseMessage message) {
    if (message.send) {
      // Choose one
      ServerID sid = subs.choose();
      if (!sid.equals(serverID)) {  //We don't send to this node
        sendRemote(sid, message);
      } else {
        receiveMessage(message);
      }
    } else {
      // Publish
      for (ServerID sid : subs) {
        if (!sid.equals(serverID)) {  //We don't send to this node
          sendRemote(sid, message);
        } else {
          receiveMessage(message);
        }
      }
View Full Code Here

TOP

Related Classes of org.vertx.java.core.net.impl.ServerID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.