Search in sources :

Example 1 with PingMessageCodec

use of io.vertx.core.eventbus.impl.codecs.PingMessageCodec in project vert.x by eclipse.

the class ConnectionHolder method schedulePing.

private void schedulePing() {
    EventBusOptions options = eventBus.options();
    pingTimeoutID = vertx.setTimer(options.getClusterPingInterval(), id1 -> {
        timeoutID = vertx.setTimer(options.getClusterPingReplyInterval(), id2 -> {
            log.warn("No pong from server " + serverID + " - will consider it dead");
            close();
        });
        ClusteredMessage pingMessage = new ClusteredMessage<>(serverID, PING_ADDRESS, null, null, null, new PingMessageCodec(), true, eventBus);
        Buffer data = pingMessage.encodeToWire();
        socket.write(data);
    });
}
Also used : PingMessageCodec(io.vertx.core.eventbus.impl.codecs.PingMessageCodec) NetClientImpl(io.vertx.core.net.impl.NetClientImpl) EventBusMetrics(io.vertx.core.spi.metrics.EventBusMetrics) Vertx(io.vertx.core.Vertx) VertxOptions(io.vertx.core.VertxOptions) ServerID(io.vertx.core.net.impl.ServerID) LoggerFactory(io.vertx.core.logging.LoggerFactory) NetClientOptions(io.vertx.core.net.NetClientOptions) Buffer(io.vertx.core.buffer.Buffer) EventBusOptions(io.vertx.core.eventbus.EventBusOptions) Queue(java.util.Queue) Logger(io.vertx.core.logging.Logger) NetClient(io.vertx.core.net.NetClient) ArrayDeque(java.util.ArrayDeque) NetSocket(io.vertx.core.net.NetSocket) Buffer(io.vertx.core.buffer.Buffer) EventBusOptions(io.vertx.core.eventbus.EventBusOptions) PingMessageCodec(io.vertx.core.eventbus.impl.codecs.PingMessageCodec)

Aggregations

Vertx (io.vertx.core.Vertx)1 VertxOptions (io.vertx.core.VertxOptions)1 Buffer (io.vertx.core.buffer.Buffer)1 EventBusOptions (io.vertx.core.eventbus.EventBusOptions)1 PingMessageCodec (io.vertx.core.eventbus.impl.codecs.PingMessageCodec)1 Logger (io.vertx.core.logging.Logger)1 LoggerFactory (io.vertx.core.logging.LoggerFactory)1 NetClient (io.vertx.core.net.NetClient)1 NetClientOptions (io.vertx.core.net.NetClientOptions)1 NetSocket (io.vertx.core.net.NetSocket)1 NetClientImpl (io.vertx.core.net.impl.NetClientImpl)1 ServerID (io.vertx.core.net.impl.ServerID)1 EventBusMetrics (io.vertx.core.spi.metrics.EventBusMetrics)1 ArrayDeque (java.util.ArrayDeque)1 Queue (java.util.Queue)1