You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tubemq.apache.org by "Guo Jiwei (Jira)" <ji...@apache.org> on 2020/06/01 12:05:00 UTC

[jira] [Updated] (TUBEMQ-90) Remove unused codes in TubeBroker

     [ https://issues.apache.org/jira/browse/TUBEMQ-90?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guo Jiwei updated TUBEMQ-90:
----------------------------
    Description: 
1. TubeBroker implements Runnable interface, I think this is a little strange. If we have some extra work to do , we can create inner thread for it. 
2. JVMClusterUtil is useless . If we support start more than one brokers in one JVM, we have to change some params, we can't set different params for different brokers at the same time. And as we will support docker in the future, we decide to remove this class.
3. remove synchronized in start method.
4. remove below codes in stop method
{code:java}
if (this.shutdown.get()) {
    return;
}
{code}
5. remove unused run method.
6. remove unused waitForServerOnline method.

  was:
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}
 

       Priority: Normal  (was: Low)
        Summary: Remove unused codes in TubeBroker  (was: Question about TubeBroker)

> Remove unused codes in TubeBroker
> ---------------------------------
>
>                 Key: TUBEMQ-90
>                 URL: https://issues.apache.org/jira/browse/TUBEMQ-90
>             Project: Apache TubeMQ
>          Issue Type: Improvement
>            Reporter: Guo Jiwei
>            Assignee: Guo Jiwei
>            Priority: Normal
>
> 1. TubeBroker implements Runnable interface, I think this is a little strange. If we have some extra work to do , we can create inner thread for it. 
> 2. JVMClusterUtil is useless . If we support start more than one brokers in one JVM, we have to change some params, we can't set different params for different brokers at the same time. And as we will support docker in the future, we decide to remove this class.
> 3. remove synchronized in start method.
> 4. remove below codes in stop method
> {code:java}
> if (this.shutdown.get()) {
>     return;
> }
> {code}
> 5. remove unused run method.
> 6. remove unused waitForServerOnline method.



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