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/05/08 02:14:00 UTC
[jira] [Commented] (TUBEMQ-90) Question about TubeBroker
[ https://issues.apache.org/jira/browse/TUBEMQ-90?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17102178#comment-17102178 ]
Guo Jiwei commented on TUBEMQ-90:
---------------------------------
[~aloyszhang] [~gosonzhang]
> Question about TubeBroker
> -------------------------
>
> Key: TUBEMQ-90
> URL: https://issues.apache.org/jira/browse/TUBEMQ-90
> Project: Apache TubeMQ
> Issue Type: Improvement
> Reporter: Guo Jiwei
> Priority: Low
>
> 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)