Example usage for org.apache.cassandra.transport.messages RegisterMessage RegisterMessage

List of usage examples for org.apache.cassandra.transport.messages RegisterMessage RegisterMessage

Introduction

In this page you can find the example usage for org.apache.cassandra.transport.messages RegisterMessage RegisterMessage.

Prototype

public RegisterMessage(List<Event.Type> eventTypes) 

Source Link

Usage

From source file:com.datastax.driver.core.ControlConnection.java

License:Apache License

private Connection tryConnect(Host host) throws ConnectionException, ExecutionException, InterruptedException {
    Connection connection = cluster.connectionFactory.open(host);

    try {//from   w w w.j  av a  2s .c o  m
        logger.trace("[Control connection] Registering for events");
        List<Event.Type> evs = Arrays.asList(new Event.Type[] { Event.Type.TOPOLOGY_CHANGE,
                Event.Type.STATUS_CHANGE, Event.Type.SCHEMA_CHANGE, });
        connection.write(new RegisterMessage(evs));

        logger.debug(String.format("[Control connection] Refreshing node list and token map"));
        refreshNodeListAndTokenMap(connection);

        logger.debug("[Control connection] Refreshing schema");
        refreshSchema(connection, null, null, cluster);
        return connection;
    } catch (BusyConnectionException e) {
        throw new DriverInternalError("Newly created connection should not be busy");
    }
}