Skip to content

Latest commit

 

History

History
34 lines (31 loc) · 1.46 KB

README.md

File metadata and controls

34 lines (31 loc) · 1.46 KB

Bully Algorithm : Java RMI

This is an implementation of Bully Algoritm using Java RMI. The implementation assumes a node to be a server implementation in Java RMI.

Steps to Run

1 Move to your project directory

$ cd [path to your directory]

2 Compile the source files. Replace destDir with your directory path

$ javac -d destDir BullyInterface.java Node1.java Node2.java Node3.java Node4.java

3 If no error message, Start the rmi registry

$ start rmiregistry

4 Start the nodes. Replace destDir with the path of your Directory

start java -classpath destDir -Djava.rmi.server.codebase=file:classDir/ bully.algorithm.Node1
start java -classpath destDir -Djava.rmi.server.codebase=file:classDir/ bully.algorithm.Node2
start java -classpath destDir -Djava.rmi.server.codebase=file:classDir/ bully.algorithm.Node3
start java -classpath destDir -Djava.rmi.server.codebase=file:classDir/ bully.algorithm.Node4

Managing Nodes

When a node is initiated it gives some output as well as start a fresh election.

Terminate a node

When on the node terminal window press ctrl + C to terminate a node.

Note : Dont close the terminal window of a node by pressing the close button. This will generate errors

Further Reading