tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: [OT] Tomcat listener not coming up - no stuck threads
Date Thu, 15 Dec 2016 22:06:40 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

John,

On 12/15/16 5:03 PM, John D. Ament wrote:
> On Thu, Dec 15, 2016 at 4:06 PM Christopher Schultz < 
> chris@christopherschultz.net> wrote:
> 
> Mark,
> 
> On 12/15/16 2:44 PM, Mark Thomas wrote:
>>>> On 15/12/2016 19:35, Christopher Schultz wrote:
>>>>> John,
>>>>> 
>>>>> On 12/14/16 10:01 PM, John D. Ament wrote:
>>>>>> I was feeling ambitious so I gave this a shot.  Here's
>>>>>> what I changed: 
>>>>>> https://github.com/johnament/tomcat85/commit/a0281b2d4e0fea7cb0f7
a9d
>
>>>>>> 
3c
> <https://github.com/johnament/tomcat85/commit/a0281b2d4e0fea7cb0f7a9d3
c>
>>>>>
>>>>>>
>
> 
d1e750b48498ff2
>>>> 
>>>> That was pretty much what I was thinking.
> 
> 
>> If you want it, let me know.  I can provide a patch.  I'm not
>> sure what tests to add, other than verify no extra threads were
>> created.  I need to setup a bugzilla account too.
> 
> 
> 
>>>> 
>>>>> My
>>>>> 
>>>>> tack was going to be to create an ExecutorService that
>>>>> didn't dispatch. That way, less code has to change.
>>>> 
>>>> Seems like more work. And doesn't solve the original problem
>>>> of the main thread holding a lock.
> 
> No, it won't hold a lock. The (Abstract)ExecutorService just 
> dispatches to the execute(Runnable job) method which can simply
> be:
> 
> job.run()
> 
> In that case, only one thread is ever involved: the thread that 
> submitted the job.
> 
> 
>> The problem is that tomcat is expecting a ThreadPoolExecutor.  It
>> may make sense to wrap it in a delegate that just handles the
>> calls you need, since you're only calling one method on the
>> executor.  That would simplify this logic as well.

That was exactly what I was going to do: create a class that would do
double-duty. So rather than if/else blocks behaving differently for
the case where 1 thread is being used rather than >1, the
ExecutorService (ThreadPoolExecutor) would handle the difference. So
it would be a one-line change to the ContainerBase class.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYUxPwAAoJEBzwKT+lPKRYmlwP/A/3F64wo3nJ46if8Ldm72hG
1zCUHD+ticxSX/wnjxjjItpy24jLw74d7ub/zuEGdXbcz0FZkL7HkX7uBqsoq/5K
SR3fS4Vukz7h4aohDrkGFqMYcI48xZOBj2qPP26PNxKgBD4JbGGA/5kP2g1ItVbC
EWhKRhHUJbP+sPqbyw6EGgxuGFczen/nXXhiTgDY5J5heG/4UoAOzCMJSbWzmywG
lpPsa3UPvrErf43WE5AH8TijwxSOOSMCQDgVSDWgo5obqPRUzYE69f1h4pap7j5M
HJlJZyaR+/5H3epfgyim1D4G6+LudvbS8chLIl0Dq9cPcFfbUny118ZSd9zs1n2D
Np0q03wL4fTSfZTe95q8OWTdmGdwpg++GIoL8hsDg6wzkkPnWOX0mC3qc4TZ5Z8P
cr+jW5VW12INwKyJROqe3KfX0IJQHS+MfddO+VDaItumibAeDeNEY+TTRsOWSq7k
MSFH8Uic/S7EoWCTrGILTVgiZ5swAZIgIYSThSEukE3smltdnjZoR9juqwqz8ZgC
ivIhrHx0lyHr36kbtebCgC/G9IRmv1oO5zNSUglCOmB4fsssxX84CUZXrcx1jxA2
rdxgImaDw1igiLyhA++RUEL33t38wFzzqk0yfuNSZIa3jX7Obs89LY+wS6Oi6lMI
bmjL4dBBuzbKbDgnTn26
=JFw5
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message