Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7824859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:44:21+00:00 2026-06-02T08:44:21+00:00

I am writing a program for Bully Algorithm in Java Here is the code:

  • 0

I am writing a program for Bully Algorithm in Java
Here is the code:

package newbully;

public class NewBully {

    public static void main(String[] args) {
        int total_processes = 6;
        RunningThread[] t = new RunningThread[total_processes];
        for (int i = 0; i < total_processes; i++) {
            t[i] = new RunningThread(new Process(i+1, i+1), total_processes);//passing process id, priority, total no. of processes to running thread
        }
        try {
            Election.initialElection(t);
        } catch (Exception e) {
            System.out.println("Possibly you are using null references in array");
        }
        for (int i = 0; i < total_processes; i++) {
            new Thread(t[i]).start();//start every thread
        }
    }
}


package newbully;

import java.util.*;
import java.io.*;
import java.net.*;

public class RunningThread implements Runnable {

    private Process process;
    private int total_processes;
    ServerSocket[] sock;
    Random r;

    public Process getProcess() {
        return process;
    }

    public void setProcess(Process process) {
        this.process = process;
    }

    public RunningThread(Process process, int total_processes) {
        this.process = process;
        this.total_processes = total_processes;
        this.r = new Random();
        this.sock = new ServerSocket[total_processes];
    }

    synchronized private void recovery() {
        System.out.println("Process[" + this.process.getPid() + "]: -> Recovered from Crash");
        //Find current co-ordinator.
    }

    synchronized private void pingCoOrdinator() {
        try {
            if (Election.isPingFlag()) {
                synchronized (Election.lock) {
                    Election.lock.wait();
                }
            }
            if (!Election.isElectionFlag()) {
                Election.setPingFlag(true);
                System.out.println("Process[" + this.process.getPid() + "]: Are you alive?");
                Socket outgoing = new Socket(InetAddress.getLocalHost(), 12345);
                outgoing.close();
                Election.setPingFlag(false);
                synchronized (Election.lock) {
                    Election.lock.notifyAll();
                }
            }
        } catch (Exception ex) {
            //Initiate Election
            System.out.println("process[" + this.process.getPid() + "]: -> Co-Ordinator is down\nInitiating Election");
            Election.setElectionFlag(true);
            Election.setPingFlag(false);
            synchronized (Election.lock) {
                Election.lock.notifyAll();
            }
        }
    }

    synchronized private void executeJob() {
        int temp = r.nextInt(20);
        for (int i = 0; i <= temp; i++) {
            try {
                Thread.sleep(700);
            } catch (InterruptedException e) {
                System.out.println("Error Executing Thread:" + process.getPid());
                System.out.println(e.getMessage());
            }
        }
    }

    synchronized private boolean sendMessage() {
        boolean response = false;
        int i = 0;
        try {
            if (Election.isMessageFlag()) {
                synchronized (Election.lock) {
                    Election.lock.wait();
                }
            }
            Election.setMessageFlag(true);
            if (Election.isElectionFlag()) {
                for (i = this.process.getPid() + 1; i <= this.total_processes; i++) {
                    try {
                        Socket electionMessage = new Socket(InetAddress.getLocalHost(), 10000 + i);
                        System.out.println("Process[" + this.process.getPid() + "] -> Process[" + i + "]  responded to election message successfully");
                        electionMessage.close();
                        response = true;
                    } catch (Exception ex) {
                        System.out.println("Process[" + this.process.getPid() + "] -> Process[" + i + "] did not respond to election message");
                    }
                }
            }
            Election.setMessageFlag(false);
            synchronized (Election.lock) {
                Election.lock.notifyAll();
            }
        } catch (Exception ex1) {
            System.out.println(ex1.getMessage());
        }

        return response;
    }

    synchronized private void serve() {
        try {
            //service counter
            Socket incoming = null;
            ServerSocket s = new ServerSocket(12345);
            for (int counter = 0; counter < 10; counter++) {
                incoming = s.accept();
                System.out.println("Process[" + this.process.getPid() + "]:Yes");
                Scanner scan = new Scanner(incoming.getInputStream());
                PrintWriter out = new PrintWriter(incoming.getOutputStream(), true);
                if (scan.hasNextLine()) {
                    if (scan.nextLine().equals("Who is the co-ordinator?")) {
                        System.out.print("Process[" + this.process.getPid() + "]:");
                        out.println(this.process);
                    }
                }
            }
            //after serving 10 requests go down for random time
            this.process.setCoOrdinatorFlag(false);
            this.process.setDownflag(true);
            try {
                incoming.close();
                s.close();
                sock[this.process.getPid() - 1].close();
                Thread.sleep((this.r.nextInt(10) + 1) * 1000000);//going down
                recovery();
            } catch (InterruptedException e) {
                System.out.println(e.getMessage());
            }


        } catch (IOException ex) {
            System.out.println(ex.getMessage());
        }
    }

    @Override
    public void run() {
        try {
            sock[this.process.getPid() - 1] = new ServerSocket(10000 + this.process.getPid());
        } catch (IOException ex) {
            System.out.println(ex.getMessage());
        }
        while (true) {
            if (process.isCoOrdinatorFlag()) {
                //serve other processes
                serve();
            } else {
                while (true) {
                    //Execute some task
                    executeJob();

                    //Ping the co-ordinator
                    pingCoOrdinator();

                    if (Election.isElectionFlag()) {
                        if (!sendMessage()) {//elect self as co-ordinator
                            System.out.println("New Co-Ordinator: Process[" + this.process.getPid() + "]");
                            this.process.setCoOrdinatorFlag(true);
                            Election.setElectionFlag(false);
                            break;
                        }
                    }
                }
            }
        }
    }
}

package newbully;

public class Election {

    private static boolean pingFlag = false;
    private static boolean electionFlag = false;
    private static boolean messageFlag = false;
    public static final Object lock = new Object(); 

    public static boolean isMessageFlag() {
        return messageFlag;
    }

    public static void setMessageFlag(boolean messageFlag) {
        Election.messageFlag = messageFlag;
    }

    public static boolean isPingFlag() {
        return pingFlag;
    }

    public static void setPingFlag(boolean pingFlag) {
        Election.pingFlag = pingFlag;
    }

    public static boolean isElectionFlag() {
        return electionFlag;
    }

    public static void setElectionFlag(boolean electionFlag) {
        Election.electionFlag = electionFlag;
    }

    public static void initialElection(RunningThread[] t) {
        Process temp = new Process(-1, -1);
        for (int i = 0; i < t.length; i++) {
            if (temp.getPriority() < t[i].getProcess().getPriority()) {
                temp = t[i].getProcess();
            }
        }
        t[temp.pid - 1].getProcess().CoOrdinatorFlag = true;
    }
}

package newbully;

public class Process {

    int pid;
    boolean downflag,CoOrdinatorFlag;

    public boolean isCoOrdinatorFlag() {
        return CoOrdinatorFlag;
    }

    public void setCoOrdinatorFlag(boolean isCoOrdinator) {
        this.CoOrdinatorFlag = isCoOrdinator;
    }
    int priority;

    public boolean isDownflag() {
        return downflag;
    }

    public void setDownflag(boolean downflag) {
        this.downflag = downflag;
    }

    public int getPid() {
        return pid;
    }

    public void setPid(int pid) {
        this.pid = pid;
    }

    public int getPriority() {
        return priority;
    }

    public void setPriority(int priority) {
        this.priority = priority;
    }

    public Process() {
    }

    public Process(int pid, int priority) {
        this.pid = pid;
        this.downflag = false;
        this.priority = priority;
        this.CoOrdinatorFlag = false;
    }
}

Here is the output:

//--When delay in executeJob() method is 100

Process[4]: Are you alive?
Process[6]:Yes
Process[4]: Are you alive?
Process[6]:Yes
Process[3]: Are you alive?
Process[6]:Yes
Process[5]: Are you alive?
Process[6]:Yes
Process[1]: Are you alive?
Process[6]:Yes
Process[4]: Are you alive?
Process[6]:Yes
Process[3]: Are you alive?
Process[6]:Yes
Process[3]: Are you alive?
Process[6]:Yes
Process[2]: Are you alive?
Process[6]:Yes
Process[5]: Are you alive?
Process[6]:Yes
Process[1]: Are you alive?
process[1]: -> Co-Ordinator is down
Initiating Election
Process[1] -> Process[2]  responded to election message successfully
Process[1] -> Process[3]  responded to election message successfully
Process[1] -> Process[4]  responded to election message successfully
Process[1] -> Process[5]  responded to election message successfully
Process[1] -> Process[6] did not respond to election message
Process[2] -> Process[3]  responded to election message successfully
Process[3] -> Process[4]  responded to election message successfully
Process[4] -> Process[5]  responded to election message successfully
Process[2] -> Process[4]  responded to election message successfully
Process[2] -> Process[5]  responded to election message successfully
Process[3] -> Process[5]  responded to election message successfully
Process[5] -> Process[6] did not respond to election message
New Co-Ordinator: Process[5]
New Co-Ordinator: Process[1]
Address already in use: JVM_Bind
Address already in use: JVM_Bind
Address already in use: JVM_Bind


 //--When delay in executeJob() method is 700
Process[3]: Are you alive?
Process[6]:Yes
Process[5]: Are you alive?
Process[6]:Yes
Process[2]: Are you alive?
Process[1]: Are you alive?
Process[6]:Yes
Process[6]:Yes
Process[5]: Are you alive?
Process[1]: Are you alive?
Process[6]:Yes
Process[6]:Yes
Process[4]: Are you alive?
Process[6]:Yes
Process[3]: Are you alive?
Process[6]:Yes
Process[2]: Are you alive?
Process[6]:Yes
Process[1]: Are you alive?
Process[6]:Yes
Process[4]: Are you alive?
process[4]: -> Co-Ordinator is down
Initiating Election
Process[4] -> Process[5]  responded to election message successfully
Process[4] -> Process[6] did not respond to election message
Process[5] -> Process[6] did not respond to election message
New Co-Ordinator: Process[5]
Process[1]: Are you alive?
Process[5]:Yes
Process[1]: Are you alive?
Process[5]:Yes
Process[3]: Are you alive?
Process[5]:Yes
Process[2]: Are you alive?
Process[5]:Yes
Process[1]: Are you alive?
Process[5]:Yes
Process[4]: Are you alive?
Process[5]:Yes
Process[2]: Are you alive?
Process[5]:Yes
Process[4]: Are you alive?
Process[5]:Yes
Process[3]: Are you alive?
Process[5]:Yes
Process[3]: Are you alive?
Process[5]:Yes
Process[2]: Are you alive?
process[2]: -> Co-Ordinator is down
Initiating Election
Process[2] -> Process[3]  responded to election message successfully
Process[2] -> Process[4]  responded to election message successfully
Process[2] -> Process[5] did not respond to election message
Process[2] -> Process[6] did not respond to election message
Process[3] -> Process[4]  responded to election message successfully
Process[3] -> Process[5] did not respond to election message
Process[3] -> Process[6] did not respond to election message
Process[1] -> Process[2]  responded to election message successfully
Process[1] -> Process[3]  responded to election message successfully
Process[1] -> Process[4]  responded to election message successfully
Process[1] -> Process[5] did not respond to election message
Process[1] -> Process[6] did not respond to election message
Process[2] -> Process[3]  responded to election message successfully
Process[2] -> Process[4]  responded to election message successfully
Process[2] -> Process[5] did not respond to election message
Process[2] -> Process[6] did not respond to election message
Process[4] -> Process[5] did not respond to election message
Process[4] -> Process[6] did not respond to election message
New Co-Ordinator: Process[4]
Process[3]: Are you alive?
Process[4]:Yes
Process[3]: Are you alive?
Process[4]:Yes
Process[1]: Are you alive?
Process[4]:Yes
Process[2]: Are you alive?
Process[4]:Yes
Process[1]: Are you alive?
Process[4]:Yes
Process[2]: Are you alive?
Process[4]:Yes
Process[2]: Are you alive?
Process[4]:Yes
Process[2]: Are you alive?
Process[4]:Yes
Process[3]: Are you alive?
Process[4]:Yes
Process[1]: Are you alive?
Process[4]:Yes
Process[3]: Are you alive?
process[3]: -> Co-Ordinator is down
Initiating Election
Process[3] -> Process[4] did not respond to election message
Process[3] -> Process[5] did not respond to election message
Process[3] -> Process[6] did not respond to election message
New Co-Ordinator: Process[3]
New Co-Ordinator: Process[2]
Address already in use: JVM_Bind
Address already in use: JVM_Bind
Address already in use: JVM_Bind
Address already in use: JVM_Bind
Address already in use: JVM_Bind

Finally I start getting exception of Address already in use: JVM_Bin.
Also if we check with the latest elected co-ordinator in ouput just before thowing exception it elects twice before asking is co-ordinator alive?
I am sure that when a co-ordinator dies I have provided enough delay to it so that it wont wake-up in between.
When I give extra dealy then program goes ahead else it stops in the middle.
Then why this problem must be occuring?

I found the reason for the exception
It is happening because if u look closely in output just before the exception message it has elected the co-ordinator 2ce.
Whenever a Thread is elected as co-ordinator it opens a ServerSocket at port 12345.
Since it happened 2ce it might be throwing exception.
But I dont get it… why did it elect the 2ce??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T08:44:24+00:00Added an answer on June 2, 2026 at 8:44 am

    After refering to all the above comments I am posting the corrected code which perfectly so others can refer it.
    Any improvements suggestion in the code are welcome…

    package newbully;
    
    public class NewBully {
    
        public static void main(String[] args) {
            int total_processes = 6;
            RunningThread[] t = new RunningThread[total_processes];
            for (int i = 0; i < total_processes; i++) {
                t[i] = new RunningThread(new Process(i+1, i+1), total_processes);//passing process id, priority, total no. of processes to running thread
            }
            try {
                Election.initialElection(t);
            } catch (NullPointerException e) {
                System.out.println(e.getMessage());
            }
            for (int i = 0; i < total_processes; i++) {
                new Thread(t[i]).start();//start every thread
            }
        }
    }
    
    package newbully;
    
    import java.util.concurrent.locks.ReentrantLock;
    
    public class Election {
    
        public static ReentrantLock pingLock = new ReentrantLock();
        public static ReentrantLock electionLock = new ReentrantLock();
        private static boolean electionFlag = false; //By default no election is going on
        private static boolean pingFlag = true; //By default I am allowed to ping 
        public static Process electionDetector;
    
        public static Process getElectionDetector() {
            return electionDetector;
        }
    
        public static void setElectionDetector(Process electionDetector) {
            Election.electionDetector = electionDetector;
        }
    
        public static boolean isPingFlag() {
            return pingFlag;
        }
    
        public static void setPingFlag(boolean pingFlag) {
            Election.pingFlag = pingFlag;
        }
    
        public static boolean isElectionFlag() {
            return electionFlag;
        }
    
        public static void setElectionFlag(boolean electionFlag) {
            Election.electionFlag = electionFlag;
        }
    
        public static void initialElection(RunningThread[] t) {
            Process temp = new Process(-1, -1);
            for (int i = 0; i < t.length; i++) {
                if (temp.getPriority() < t[i].getProcess().getPriority()) {
                    temp = t[i].getProcess();
                }
            }
            t[temp.pid - 1].getProcess().CoOrdinatorFlag = true;
        }
    }
    
    package newbully;
    
    import java.util.*;
    import java.io.*;
    import java.net.*;
    
    public class RunningThread implements Runnable {
    
        private Process process;
        private int total_processes;
        private static boolean messageFlag[];
        ServerSocket[] sock;
        Random r;
    
        public Process getProcess() {
            return process;
        }
    
        public void setProcess(Process process) {
            this.process = process;
        }
    
        public RunningThread(Process process, int total_processes) {
            this.process = process;
            this.total_processes = total_processes;
            this.r = new Random();
            this.sock = new ServerSocket[total_processes];
            RunningThread.messageFlag = new boolean[total_processes];
            for (int i = 0; i < total_processes; i++) {
                RunningThread.messageFlag[i] = false;
            }
        }
    
        synchronized private void recovery() {
            while (Election.isElectionFlag());//if election is going on then wait
            System.out.println("Process[" + this.process.getPid() + "]: -> Recovered from Crash");
            //Find current co-ordinator.         
            try {
                Election.pingLock.lock();
                Election.setPingFlag(false);
                Socket outgoing = new Socket(InetAddress.getLocalHost(), 12345);
                Scanner scan = new Scanner(outgoing.getInputStream());
                PrintWriter out = new PrintWriter(outgoing.getOutputStream(), true);
                System.out.println("Process[" + this.process.getPid() + "]:-> Who is the co-ordinator?");
                out.println("Who is the co-ordinator?");
                out.flush();
                String pid = scan.nextLine();
                String priority = scan.nextLine();
                if (this.process.getPriority() > Integer.parseInt(priority)) { //Bully Condition
                    out.println("Resign");
                    out.flush();
                    System.out.println("Process[" + this.process.getPid() + "]: Resign -> Process[" + pid + "]");
                    String resignStatus = scan.nextLine();
                    if (resignStatus.equals("Successfully Resigned")) {
                        this.process.setCoOrdinatorFlag(true);
                        sock[this.process.getPid() - 1] = new ServerSocket(10000 + this.process.getPid());
                        System.out.println("Process[" + this.process.getPid() + "]: -> Bullyed current co-ordinator Process[" + pid + "]");
                    }
                } else {
                    out.println("Don't Resign");
                    out.flush();
                }
                Election.pingLock.unlock();
                return;
    
            } catch (IOException ex) {
                System.out.println(ex.getMessage());
            }
    
        }
    
        synchronized private void pingCoOrdinator() {
            try {
                Election.pingLock.lock();
                if (Election.isPingFlag()) {
                    System.out.println("Process[" + this.process.getPid() + "]: Are you alive?");
                    Socket outgoing = new Socket(InetAddress.getLocalHost(), 12345);
                    outgoing.close();
                }
            } catch (Exception ex) {
                Election.setPingFlag(false);
                Election.setElectionFlag(true);
                Election.setElectionDetector(this.process);
                //Initiate Election
                System.out.println("process[" + this.process.getPid() + "]: -> Co-Ordinator is down\n" + "process[" + this.process.getPid() + "]: ->Initiating Election");
            } finally {
                Election.pingLock.unlock();
            }
        }
    
        private void executeJob() {
            int temp = r.nextInt(20);
            for (int i = 0; i <= temp; i++) {
                try {
                    Thread.sleep((temp + 1) * 100);
                } catch (InterruptedException e) {
                    System.out.println("Error Executing Thread:" + process.getPid());
                    System.out.println(e.getMessage());
                }
            }
        }
    
        synchronized private boolean sendMessage() {
            boolean response = false;
            try {
                Election.electionLock.lock();
                if (Election.isElectionFlag() && !RunningThread.isMessageFlag(this.process.getPid() - 1) && this.process.priority >= Election.getElectionDetector().getPriority()) {
    
                    for (int i = this.process.getPid() + 1; i <= this.total_processes; i++) {
                        try {
                            Socket electionMessage = new Socket(InetAddress.getLocalHost(), 10000 + i);
                            System.out.println("Process[" + this.process.getPid() + "] -> Process[" + i + "]  responded to election message successfully");
                            electionMessage.close();
                            response = true;
                        } catch (IOException ex) {
                            System.out.println("Process[" + this.process.getPid() + "] -> Process[" + i + "] did not respond to election message");
                        } catch (Exception ex) {
                            System.out.println(ex.getMessage());
                        }
                    }
                    this.setMessageFlag(true, this.process.getPid() - 1);//My message sending is done
                    Election.electionLock.unlock();
                    return response;
                } else {
                    throw new Exception();
                }
            } catch (Exception ex1) {
                Election.electionLock.unlock();
                return true;
            }
        }
    
        public static boolean isMessageFlag(int index) {
            return RunningThread.messageFlag[index];
        }
    
        public static void setMessageFlag(boolean messageFlag, int index) {
            RunningThread.messageFlag[index] = messageFlag;
        }
    
        synchronized private void serve() {
            try {
                boolean done = false;
                Socket incoming = null;
                ServerSocket s = new ServerSocket(12345);
                Election.setPingFlag(true);
                int temp = this.r.nextInt(5) + 5;// min 5 requests and max 10 requests
                for (int counter = 0; counter < temp; counter++) {
                    incoming = s.accept();
                    if (Election.isPingFlag()) {
                        System.out.println("Process[" + this.process.getPid() + "]:Yes");
                    }
                    Scanner scan = new Scanner(incoming.getInputStream());
                    PrintWriter out = new PrintWriter(incoming.getOutputStream(), true);
                    while (scan.hasNextLine() && !done) {
                        String line = scan.nextLine();
                        if (line.equals("Who is the co-ordinator?")) {
                            System.out.println("Process[" + this.process.getPid() + "]:-> " + this.process.getPid());
                            out.println(this.process.getPid());
                            out.flush();
                            out.println(this.process.getPriority());
                            out.flush();
                        } else if (line.equals("Resign")) {
                            this.process.setCoOrdinatorFlag(false);
                            out.println("Successfully Resigned");
                            out.flush();
                            incoming.close();
                            s.close();
                            System.out.println("Process[" + this.process.getPid() + "]:-> Successfully Resigned");
                            return;
                        } else if (line.equals("Don't Resign")) {
                            done = true;
                        }
                    }
                }
                //after serving 5-10 requests go down for random time
                this.process.setCoOrdinatorFlag(false);
                this.process.setDownflag(true);
                try {
                    incoming.close();
                    s.close();
                    sock[this.process.getPid() - 1].close();
                    Thread.sleep(15000);//(this.r.nextInt(10) + 1) * 10000);//going down
                    recovery();
                } catch (Exception e) {
                    System.out.println(e.getMessage());
                }
    
    
            } catch (IOException ex) {
                System.out.println(ex.getMessage());
            }
        }
    
        @Override
        public void run() {
            try {
                sock[this.process.getPid() - 1] = new ServerSocket(10000 + this.process.getPid());
            } catch (IOException ex) {
                System.out.println(ex.getMessage());
            }
            while (true) {
                if (process.isCoOrdinatorFlag()) {
                    //serve other processes
                    serve();
                } else {
                    while (true) {
                        //Execute some task
                        executeJob();
                        //Ping the co-ordinator
                        pingCoOrdinator();
                        //Do Election
                        if (Election.isElectionFlag()) {
                            if (!sendMessage()) {//elect self as co-ordinator
                                Election.setElectionFlag(false);//Election is Done
                                System.out.println("New Co-Ordinator: Process[" + this.process.getPid() + "]");
                                this.process.setCoOrdinatorFlag(true);
                                for (int i = 0; i < total_processes; i++) {
                                    RunningThread.setMessageFlag(false, i);
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
    }
    
    package newbully;
    
    public class Process {
    
        int pid;
        boolean downflag,CoOrdinatorFlag;
    
        public boolean isCoOrdinatorFlag() {
            return CoOrdinatorFlag;
        }
    
        public void setCoOrdinatorFlag(boolean isCoOrdinator) {
            this.CoOrdinatorFlag = isCoOrdinator;
        }
        int priority;
    
        public boolean isDownflag() {
            return downflag;
        }
    
        public void setDownflag(boolean downflag) {
            this.downflag = downflag;
        }
    
        public int getPid() {
            return pid;
        }
    
        public void setPid(int pid) {
            this.pid = pid;
        }
    
        public int getPriority() {
            return priority;
        }
    
        public void setPriority(int priority) {
            this.priority = priority;
        }
    
        public Process() {
        }
    
        public Process(int pid, int priority) {
            this.pid = pid;
            this.downflag = false;
            this.priority = priority;
            this.CoOrdinatorFlag = false;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a program and have some code inside a string. This code
I am writing a program that will change java code. It changes the next-line
Currently I am writing a program for an introductory Java class. I have two
I am writing a program that needs to run a java.jar server. I need
I am writing a program to add to and update an address book. Here
I am writing a program to grade C++ code that students submit. Right now
I was writing a program that tell the user to input a random string,
Im writing a program which uses simple neural network perception algorithm, I have problem
Before writing this program,I thought that our is a package scope variable and my
Im writing a program that should read input via stdin, so I have the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.