The C# ClusterConnection Class

ClusterConnection extends the Connection class for cluster applications. Use this class to participate in cluster communication, manage node attachment, inspect cluster status, and control scatter/gather operations.

For an overview see page C# Classes

Class Definition

    public class ClusterConnection : Connection
    {
        // ===== CONSTRUCTOR =====
        public ClusterConnection(Database db);

        // ===== CLUSTER LIFECYCLE METHODS =====
        public void Listen();
        public void Barrier();
        public void Detach();
        public void Stop();

        // ===== CLUSTER INFORMATION METHODS =====
        public Database.ClusterInfo GetInfo();
        public Database.ClusterNodeInfo[] GetActiveNodes();

        // ===== WINDOW CONFIGURATION METHODS =====
        public void SetWindowParams(Database.ClusterWindow WindowParam);
        public Database.ClusterWindow GetWindowParams();

        // ===== DATA DISTRIBUTION METHODS =====
        public bool Scatter(Type[] classes, int[] nodeIds);
        public bool Scatter(Type[] classes);
        public bool Scatter();

        public bool Gather(Type[] classes, int[] nodeIds);
        public bool Gather(Type[] classes);
        public bool Gather();

        // ===== CLUSTER ATTACHMENT =====
        public void Attach(Database.ClusterParams clusterParams);
    }

Member Descriptions

ClusterConnection(Database)
Creates a cluster connection instance for the specified database. The database is typically opened with Database.Mode.ClusterSupport and configured with Database.ClusterParams. Use this connection to manage node participation in the eXtremeDB cluster.
Listen()
Starts the cluster listener thread for this node. After this call, the node is available for cluster communication and synchronization.
Barrier()
Blocks this node until all cluster nodes have called Barrier(). This is useful for coordinating cluster-wide phases of work.
Detach()
Detaches this node from the cluster. In the graceful case, the node stops participating in cluster communication and leaves the cluster cleanly.
Stop()
Stops cluster network communications. In the cluster samples, this call returns after all nodes call Stop(). Use Detach() when a graceful cluster leave is required.
GetInfo()
Returns information about the current cluster connection through Database.ClusterInfo, including counters such as bytes sent/received, active node count, and this node's identifier.
GetActiveNodes()
Returns information about the active nodes in the cluster through Database.ClusterNodeInfo values such as node address, quorum rank, and node ID.
SetWindowParams(Database.ClusterWindow)
Sets asynchronous replication window parameters for this connection. These values affect how changes are propagated between cluster nodes.
GetWindowParams()
Returns the current cluster window parameters through Database.ClusterWindow.
Scatter(Type[], int[])
Distributes changes to distributed objects in this node's local cache to the specified cluster nodes. classes selects which classes to process, and nodeIds selects the destination nodes.
Scatter(Type[]) / Scatter()
Convenience overloads that scatter either the specified classes to all nodes or all eligible classes using the default node selection.
Gather(Type[], int[])
Receives changes to distributed objects from the specified cluster nodes. This is the complementary operation to Scatter().
Gather(Type[]) / Gather()
Convenience overloads that gather either the specified classes from all nodes or all eligible classes using the default node selection.
Attach(Database.ClusterParams)
Attaches this node to a cluster using the specified Database.ClusterParams configuration, including node, network, and window settings.
Cluster Prerequisites
Cluster applications typically open the database with Database.Mode.ClusterSupport. In the C# implementation, cluster mode also uses MVCC transaction management, and node/network settings are supplied through Database.ClusterParams.
Listener Workflow
A common pattern is to start Listen() on a dedicated thread, perform cluster work through another ClusterConnection, call Stop() when shutting down, and then wait for the listener thread to exit.
Window Parameters
Database.ClusterWindow includes Length, BSize, and Timeout. These values control the cluster replication window used by this node.
Scatter And Gather
Scatter() and Gather() operate on distributed classes and internally translate managed Type values to class identifiers from the current database dictionary.
Cluster Topology
eXtremeDB clusters can combine data distribution and replication behavior. Node roles and communication behavior depend on the lower-level cluster configuration supplied in Database.ClusterParams and related structures.
Data Distribution Strategy
Use Scatter() to distribute work or distributed object changes across nodes, and Gather() to collect them back when consolidation or cross-node processing is required.
Synchronization Guarantees
Barrier() provides a synchronization point across cluster nodes. Combine it with GetInfo() when coordinating critical cluster operations.
Graceful Shutdown
A typical graceful sequence is to finish cluster work, use Detach() when appropriate, call Stop(), wait for listener activity to end, and then disconnect and close the database.
Thread Safety
ClusterConnection instances are not thread-safe. Use one instance per thread, and coordinate cluster management actions externally to avoid conflicting topology changes.
Error Handling
Scatter() and Gather() return false on failure. When diagnosing cluster issues, inspect GetInfo(), node notifications, and runtime logs.
Configuration Persistence
Cluster settings applied through Attach() and SetWindowParams() affect the current runtime session. Persisted cluster behavior may also depend on the lower-level cluster configuration used to open the database.
Shutdown Sequence
The cluster samples typically perform work, call Stop(), wait for the listener thread to finish, inspect GetInfo(), and then disconnect and close the database.