Class Worker

  • All Implemented Interfaces:
    Runnable

    public class Worker
    extends Object
    implements Runnable
    This class simulates the job of a worker. It will attempt to take a message off the queue, work on it, and issue a reply. The length of time taken on each message will vary per message based on a difficulty index. The worker will quite when it hits its max value; always failing to repond to the last request processed (on purpose).
    • Field Detail

      • logger

        private static final org.slf4j.Logger logger
      • stop

        protected boolean stop
      • stopped

        protected boolean stopped
      • started

        protected boolean started
      • noFail

        protected boolean noFail
      • count

        protected int count
      • maxCount

        protected int maxCount
      • delay

        protected long[] delay
      • username

        protected String username
      • password

        protected String password
    • Constructor Detail

      • Worker

        public Worker​(String name)
    • Method Detail

      • setRequestQueue

        public void setRequestQueue​(Destination requestQueue)
      • getCount

        public int getCount()
      • setMaxCount

        public void setMaxCount​(int maxCount)
      • clearMessages

        public void clearMessages()
      • stop

        public void stop()
      • isStopped

        public boolean isStopped()
      • isStarted

        public boolean isStarted()
      • setNoFail

        public void setNoFail​(boolean noFail)
      • setUsername

        public void setUsername​(String username)
      • setPassword

        public void setPassword​(String password)
      • run

        public void run()
        Specified by:
        run in interface Runnable
      • main

        public static void main​(String[] args)