# The Java ClusterConnection Class

ClusterConnection extends the Connection class for eXtremeDB Cluster applications.

### Class Definition

        public class ClusterConnection extends Connection
        {
            public ClusterConnection(Database db)
            {
                super(db);
            }

            public void listen()
            {
                listen(id);
            }

            public void barrier()
            {
                barrier(id);
            }

            public void detach()
            {
                detach(id);
            }

            public void stop()
            {
                stop(id);
            }

            public Database.ClusterInfo getInfo()
            {
                return getInfo(id);
            }

            public void setWindowParams(Database.ClusterWindow windowParams)
            {
                setWindowParams(id, windowParams);
            }

            public Database.ClusterWindow getWindowParams()
            {
                return getWindowParams(id);
            }

            public Database.ClusterNodeInfo[] getActiveNodes()
            {
                return getActiveNodes(id);
            }

            public boolean scatter(Class [] classes, int [] nodeIds)
            {
                ...
            }
            public boolean scatter()
            {
                return scatter(null, null);
            }
            public boolean scatter(Class [] classes)
            {
                return scatter(classes, null);
            }

            public boolean gather(Class [] classes, int [] nodeIds)
            {
                ...
            }
            public boolean gather()
            {
                return gather(null, null);
            }
            public boolean gather(Class [] classes)
            {
                return gather(classes, null);
            }

            public void attach(Database.ClusterParams clusterParams)
            {
                attach(id, clusterParams, db, db.config);
            }
        }

### Methods

`public ClusterConnection(Database db)` | Constructor: return a ClusterConnection instance for the specified Database
`public void listen()` | Start the cluster listener thread
`public void barrier()` | Block this node until all cluster nodes have called it
`public void attach(Database.ClusterParams clusterParams)` | Attach this node to an active cluster
`public void detach()` | Detach this node from the cluster
`public void stop()` | Stop cluster network communications
`public Database.ClusterInfo getInfo()` | Return information about the current ClusterConnection
`public void setWindowParams(Database.ClusterWindow windowParams)` | Set asynchronous replication window parameters
`public Database.ClusterNodeInfo[] getActiveNodes()` | Return information about the active nodes in the cluster
`public boolean scatter(Class [] classes, int [] nodeIds)` | Distribute changes to “distributed” objects in this nodes local cache to other nodes in the cluster
`public boolean gather(Class [] classes, int [] nodeIds)` | Receive changes to “distributed” objects on other nodes in the cluster