[
https://issues.apache.org/jira/browse/TUBEMQ-66?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17083766#comment-17083766
]
Aloys Zhang edited comment on TUBEMQ-66 at 4/15/20, 3:34 AM:
-------------------------------------------------------------
Hi, [~gosonzhang], [~technoboy]
I think we should reopen this issue, since for now, TubeSingleSessionFactory
can only be closed if we invoke TubeSingleSessionFactory#shutdown() twice and
it seems a little weired.
>From my perspective, TubeSingleSessionFactory provide guarantee for all
>producers and consumers that in the same progress shares the same channel to
>one broker/master node. So if we shutdown a producer/consumer,we can't just
>simple shutdown TubeSingleSessionFactory since there may be some other
>producer/consumer still using it.
A better way, I think, we can shutdown TubeSingleSessionFactory dependent
on whether there are some active producer/consumer. This information is hold by
TubeBaseSessionFactory.clients. A producer/consumer added to the list when
initialized while remove from the list when shutown. So, if
TubeBaseSessionFactory.clients has no content, it means there are no active
producer/consumer and it's safe to shutdown TubeSingleSessionFactory.
was (Author: aloyszhang):
[~gosonzhang] [~technoboy]
I think we should reopen this issue, since for now, TubeSingleSessionFactory
can only be closed if we invoke TubeSingleSessionFactory#shutdown() twice and
it seems a little weired.
>From my perspective, TubeSingleSessionFactory provide guarantee for all
>producers and consumers that in the same progress shares the same channel to
>one broker/master node. So if we shutdown a producer/consumer,we can't just
>simple shutdown TubeSingleSessionFactory since there may be some other
>producer/consumer still using it.
A better way, I think, we can shutdown TubeSingleSessionFactory dependent
on whether there are some active producer/consumer. This information is hold by
TubeBaseSessionFactory.clients. A producer/consumer added to the list when
initialized while remove from the list when shutown. So, if
TubeBaseSessionFactory.clients has no content, it means there are no active
producer/consumer and it's safe to shutdown TubeSingleSessionFactory.
> TubeSingleSessionFactory shutdown bug
> -------------------------------------
>
> Key: TUBEMQ-66
> URL: https://issues.apache.org/jira/browse/TUBEMQ-66
> Project: Apache TubeMQ
> Issue Type: Bug
> Reporter: Guo Jiwei
> Assignee: Guo Jiwei
> Priority: Normal
> Labels: pull-request-available
> Time Spent: 20m
> Remaining Estimate: 0h
>
> 1. TubeSingleSessionFactory could not shutdown
> due to we increase referenceCounter one more time after first constructor
> method:
> {code:java}
> public TubeSingleSessionFactory(final TubeClientConfig tubeClientConfig)
> throws TubeClientException {
> if (referenceCounter.incrementAndGet() == 1) {
> RpcConfig config =
> TubeClientConfigUtils.getRpcConfigByClientConfig(tubeClientConfig, true);
> clientFactory.configure(config);
> //#1
> referenceCounter.incrementAndGet();
> baseSessionFactory = new TubeBaseSessionFactory(clientFactory,
> tubeClientConfig);
> }
> }
> {code}
> We should remove #1
--
This message was sent by Atlassian Jira
(v8.3.4#803005)