Guo Jiwei created TUBEMQ-90:
-------------------------------

             Summary: Question about TubeBroker
                 Key: TUBEMQ-90
                 URL: https://issues.apache.org/jira/browse/TUBEMQ-90
             Project: Apache TubeMQ
          Issue Type: Improvement
            Reporter: Guo Jiwei


1. Why we make a object of Sleeper in the constructor method of TubeBroker :
{code:java}
this.sleeper = new Sleeper(3000, this);
{code}
 and where do we call run method :
{code:java}
@Override
public void run() {
      try {
            this.start();
            while (!this.shutdown.get()) {
                this.sleeper.sleep();
            }
        } catch (Exception e) {
            logger.error("Running exception.", e);
        }
        this.stop("Stop running.");
}
{code}
and much more , we add synchronized in start method:

{code:java}
public synchronized void start()
{code}

2.  Remove #1:
{code:java}
    @Override
    public void stop(String why) {
        //#1
        if (this.shutdown.get()) {
            return;
        }
        if (!shutdown.compareAndSet(false, true)) {
            return;
        }
{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to