[
https://issues.apache.org/jira/browse/LOG4J2-715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14092109#comment-14092109
]
Matt Sicker commented on LOG4J2-715:
------------------------------------
I had an idea on how {{AbstractLifeCycle}} could work in a more thread-safe
fashion using concurrent utils. I'd use {{AtomicReference}} over volatile in
order to perform atomic {{compareAndSet}} operations instead of making
{{start()}} or {{stop()}} synchronized. This way would at least enforce that
{{start()}} and {{stop()}} are only called once per cycle, and only when the
state is appropriate. This is why I brought up the thread on the list.
The {{AbstractManager}} reference counting sounds like it could be better done
via either a {{Semaphore}} (if reference count has a maximum), or a custom
implementation of {{AbstractQueuedSynchronizer}} for ensuring clean shutdown
(which could be re-used by LOG4J2-702 in {{LoggerContext}}).
> org.apache.logging.log4j.core.appender.db.AbstractDatabaseManager should
> implement org.apache.logging.log4j.core.LifeCycle
> --------------------------------------------------------------------------------------------------------------------------
>
> Key: LOG4J2-715
> URL: https://issues.apache.org/jira/browse/LOG4J2-715
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 2.0
> Environment: Apache Maven 3.2.2
> (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T09:51:42-04:00)
> Maven home: C:\Java\apache-maven-3.2.2
> Java version: 1.7.0_60, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk1.7.0_60\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
> Reporter: Gary Gregory
> Assignee: Matt Sicker
> Attachments: AbstractDatabaseManager_LifeCycle.patch
>
>
> {{org.apache.logging.log4j.core.appender.db.AbstractDatabaseManager}} should
> implement {{org.apache.logging.log4j.core.LifeCycle}} instead of inventing
> its own life cycle methods.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]