Implementation of Ring Algorithm for distributed systems in java