org.jgroups.demos

Class Topology

Implemented Interfaces:
WindowListener, MembershipListener

public class Topology
extends Frame
implements WindowListener, MembershipListener

Demonstrates the membership service. Each member is represented by a rectangle that contains the addresses of all the members. The coordinator (= oldest member in the group) is painted in blue. New members can be started; all existing members will update their graphical appearance to reflect the new membership. When the coordinator itself is killed, another one will take over (the next in rank).

A nice demo is to start a number of Topology instances at the same time. All of them will be blue (all are coordinators since they don't find each other). Then the MERGE2 protocol sets in and only one will retain its coordinator role. todo: needs to be ported to Swing

Author:
Bela Ban

Constructor Summary

Topology()

Method Summary

void
addNode(Object member)
void
block()
void
coordinatorChosen()
void
drawNode(Graphics g, int x, int y, String label, int style)
void
drawTopology(Graphics g)
static void
main(String[] args)
void
paint(Graphics g)
void
removeNode(Object member)
void
setState(Vector mbrs)
void
start()
void
suspect(Address suspected_mbr)
void
viewAccepted(View view)
void
windowActivated(WindowEvent e)
void
windowClosed(WindowEvent e)
void
windowClosing(WindowEvent e)
void
windowDeactivated(WindowEvent e)
void
windowDeiconified(WindowEvent e)
void
windowIconified(WindowEvent e)
void
windowOpened(WindowEvent e)

Constructor Details

Topology

public Topology()

Method Details

addNode

public void addNode(Object member)

block

public void block()
Specified by:
block in interface MembershipListener

coordinatorChosen

public void coordinatorChosen()

drawNode

public void drawNode(Graphics g,
                     int x,
                     int y,
                     String label,
                     int style)

drawTopology

public void drawTopology(Graphics g)

main

public static void main(String[] args)

paint

public void paint(Graphics g)

removeNode

public void removeNode(Object member)

setState

public void setState(Vector mbrs)

start

public void start()
            throws Exception

suspect

public void suspect(Address suspected_mbr)
Specified by:
suspect in interface MembershipListener

viewAccepted

public void viewAccepted(View view)
Specified by:
viewAccepted in interface MembershipListener

windowActivated

public void windowActivated(WindowEvent e)

windowClosed

public void windowClosed(WindowEvent e)

windowClosing

public void windowClosing(WindowEvent e)

windowDeactivated

public void windowDeactivated(WindowEvent e)

windowDeiconified

public void windowDeiconified(WindowEvent e)

windowIconified

public void windowIconified(WindowEvent e)

windowOpened

public void windowOpened(WindowEvent e)

Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.