com.datastax.driver.core

## Interface SchemaChangeListener

• public interface SchemaChangeListener
Interface for objects that are interested in tracking schema change events in the cluster.

An implementation of this interface can be registered against a Cluster object through the Cluster.register(SchemaChangeListener) method.

Note that the methods defined by this interface will be executed by internal driver threads, and are therefore expected to have short execution times. If you need to perform long computations or blocking calls in response to schema change events, it is strongly recommended to schedule them asynchronously on a separate thread provided by our application code.

• ### Method Summary

All Methods
Modifier and Type Method and Description
void onKeyspaceAdded(KeyspaceMetadata keyspace)
Called when a keyspace has been added.
void onKeyspaceChanged(KeyspaceMetadata current, KeyspaceMetadata previous)
Called when a keyspace has changed.
void onKeyspaceRemoved(KeyspaceMetadata keyspace)
Called when a keyspace has been removed.
void onRegister(Cluster cluster)
Gets invoked when the listener is registered with a cluster.
void onTableAdded(TableMetadata table)
Called when a table has been added.
void onTableChanged(TableMetadata current, TableMetadata previous)
Called when a table has changed.
void onTableRemoved(TableMetadata table)
Called when a table has been removed.
void onUnregister(Cluster cluster)
Gets invoked when the listener is unregistered from a cluster, or at cluster shutdown if the tracker was not unregistered.
void onUserTypeAdded(UserType type)
Called when a user-defined type has been added.
void onUserTypeChanged(UserType current, UserType previous)
Called when a user-defined type has changed.
void onUserTypeRemoved(UserType type)
Called when a user-defined type has been removed.
• ### Method Detail

void onKeyspaceAdded(KeyspaceMetadata keyspace)
Called when a keyspace has been added.
Parameters:
keyspace - the keyspace that has been added.
• #### onKeyspaceRemoved

void onKeyspaceRemoved(KeyspaceMetadata keyspace)
Called when a keyspace has been removed.
Parameters:
keyspace - the keyspace that has been removed.
• #### onKeyspaceChanged

void onKeyspaceChanged(KeyspaceMetadata current,
KeyspaceMetadata previous)
Called when a keyspace has changed.
Parameters:
current - the keyspace that has changed, in its current form (after the change).
previous - the keyspace that has changed, in its previous form (before the change).

void onTableAdded(TableMetadata table)
Called when a table has been added.
Parameters:
table - the table that has been newly added.
• #### onTableRemoved

void onTableRemoved(TableMetadata table)
Called when a table has been removed.
Parameters:
table - the table that has been removed.
• #### onTableChanged

void onTableChanged(TableMetadata current,
TableMetadata previous)
Called when a table has changed.
Parameters:
current - the table that has changed, in its current form (after the change).
previous - the table that has changed, in its previous form (before the change).

void onUserTypeAdded(UserType type)
Called when a user-defined type has been added.
Parameters:
type - the type that has been newly added.
• #### onUserTypeRemoved

void onUserTypeRemoved(UserType type)
Called when a user-defined type has been removed.
Parameters:
type - the type that has been removed.
• #### onUserTypeChanged

void onUserTypeChanged(UserType current,
UserType previous)
Called when a user-defined type has changed.
Parameters:
current - the type that has changed, in its current form (after the change).
previous - the type that has changed, in its previous form (before the change).
• #### onRegister

void onRegister(Cluster cluster)
Gets invoked when the listener is registered with a cluster.
Parameters:
cluster - the cluster that this tracker is registered with.
• #### onUnregister

void onUnregister(Cluster cluster)
Gets invoked when the listener is unregistered from a cluster, or at cluster shutdown if the tracker was not unregistered.
Parameters:
cluster - the cluster that this tracker was registered with.