You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Remko Popma <re...@gmail.com> on 2017/01/24 23:03:15 UTC

Re: logging-log4j2 git commit: Use an ExecutorService to verify shutdown of the async threads

What's the purpose of the EmptyQueue? What would happen if a configuration has multiple rolling files that all roll over at the same time, would EmptyQueue prevent the 2nd task from being scheduled?

Small detail:
public boolean releaseSub(final long timeout, final TimeUnit timeUnit) {
+        LOGGER.debug("Shutting down RollingFileManager {}" + getName()); // '+' should be ','

Also not sure if the code restores the interrupt flag diligently enough. Need to check on a pc later. 

Sent from my iPhone

> On Jan 25, 2017, at 6:48, rgoers@apache.org wrote:
> 
> 
> +                if (asyncExecutor.isTerminated()) {
> +                    LOGGER.debug

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Re: logging-log4j2 git commit: Use an ExecutorService to verify shutdown of the async threads

Posted by Mikael Ståldal <mi...@magine.com>.
I hope this will not trigger https://issues.apache.
org/jira/browse/LOG4J2-1748 again.

It does not, I just tested.

We would need a unit test for that.



On Wed, Jan 25, 2017 at 2:26 AM, Apache <ra...@dslextreme.com> wrote:

> According to the Javadoc, the ExecutorService will first create threads up
> to corePoolSize. Those threads will be left active in the pool. Next, if
> there are more that corePoolSize but less than maximumPoolSize threads
> running then the request will be added to the queue. If the queue is full
> then a new thread will be created.
>
> So in our case, since corePoolSize is zero no threads will ever be left
> running. Since the queue size is zero every new execution will create a new
> thread. I did this since you mentioned multiple async requests should be
> allowed to run simultaneously. But as I think about it, each
> RollingFileManager will probably only ever have a single async task running
> at a time, so it may not matter.
>
> Ralph
>
> > On Jan 24, 2017, at 4:03 PM, Remko Popma <re...@gmail.com> wrote:
> >
> > What's the purpose of the EmptyQueue? What would happen if a
> configuration has multiple rolling files that all roll over at the same
> time, would EmptyQueue prevent the 2nd task from being scheduled?
> >
> > Small detail:
> > public boolean releaseSub(final long timeout, final TimeUnit timeUnit) {
> > +        LOGGER.debug("Shutting down RollingFileManager {}" +
> getName()); // '+' should be ','
> >
> > Also not sure if the code restores the interrupt flag diligently enough.
> Need to check on a pc later.
> >
> > Sent from my iPhone
> >
> >> On Jan 25, 2017, at 6:48, rgoers@apache.org wrote:
> >>
> >>
> >> +                if (asyncExecutor.isTerminated()) {
> >> +                    LOGGER.debug
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-dev-help@logging.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>


-- 
[image: MagineTV]

*Mikael Ståldal*
Senior software developer

*Magine TV*
mikael.staldal@magine.com
Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com

Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.

Re: logging-log4j2 git commit: Use an ExecutorService to verify shutdown of the async threads

Posted by Apache <ra...@dslextreme.com>.
According to the Javadoc, the ExecutorService will first create threads up to corePoolSize. Those threads will be left active in the pool. Next, if there are more that corePoolSize but less than maximumPoolSize threads running then the request will be added to the queue. If the queue is full then a new thread will be created.

So in our case, since corePoolSize is zero no threads will ever be left running. Since the queue size is zero every new execution will create a new thread. I did this since you mentioned multiple async requests should be allowed to run simultaneously. But as I think about it, each RollingFileManager will probably only ever have a single async task running at a time, so it may not matter.

Ralph

> On Jan 24, 2017, at 4:03 PM, Remko Popma <re...@gmail.com> wrote:
> 
> What's the purpose of the EmptyQueue? What would happen if a configuration has multiple rolling files that all roll over at the same time, would EmptyQueue prevent the 2nd task from being scheduled?
> 
> Small detail:
> public boolean releaseSub(final long timeout, final TimeUnit timeUnit) {
> +        LOGGER.debug("Shutting down RollingFileManager {}" + getName()); // '+' should be ','
> 
> Also not sure if the code restores the interrupt flag diligently enough. Need to check on a pc later. 
> 
> Sent from my iPhone
> 
>> On Jan 25, 2017, at 6:48, rgoers@apache.org wrote:
>> 
>> 
>> +                if (asyncExecutor.isTerminated()) {
>> +                    LOGGER.debug
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org