[ 
https://issues.apache.org/jira/browse/MINIFICPP-2256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ferenc Gerlits updated MINIFICPP-2256:
--------------------------------------
    Description: 
1. {{LoggerConfiguration}} has a private constructor and a public 
{{newInstance}} method, which returns a pointer.  This means we can create new 
instances, but only on the heap, which makes no sense.  Remove {{newInstance}}, 
make the constructor public, and update tests to create {{LoggerConfiguration}} 
objects on the stack.

2. If possible, we should also make the ownership of {{LoggerConfiguration}} 
clearer in the production use cases.  Currently, we use it as a singleton, via 
the {{getInstance}} method.  It would be better to have a clear (non-static) 
owner for it, and users got a reference or pointer to {{LoggerConfiguration}} 
from the owner.  Then we could remove {{getInstance}}, as well.

  was:
1. {{LoggerConfiguration}} has a private constructor and a public 
{{newInstance}} method, which returns a pointer.  This means we can create new 
instances, but only on the heap, which makes no sense.  Remove 
{{newInstance()}}, make the constructor public, and update tests to create 
{{LoggerConfiguration}} objects on the stack.

2. If possible, we should also make the ownership of {{LoggerConfiguration}} 
clearer in the production use cases.  Currently, we use it as a singleton, via 
the {{getInstance}} method.  It would be better to have a clear (non-static) 
owner for it, and users got a reference or pointer to {{LoggerConfiguration}} 
from the owner.  Then we could remove {{getInstance}}, as well.


> Un-singletonize LoggerConfiguration
> -----------------------------------
>
>                 Key: MINIFICPP-2256
>                 URL: https://issues.apache.org/jira/browse/MINIFICPP-2256
>             Project: Apache NiFi MiNiFi C++
>          Issue Type: Improvement
>            Reporter: Ferenc Gerlits
>            Priority: Minor
>
> 1. {{LoggerConfiguration}} has a private constructor and a public 
> {{newInstance}} method, which returns a pointer.  This means we can create 
> new instances, but only on the heap, which makes no sense.  Remove 
> {{newInstance}}, make the constructor public, and update tests to create 
> {{LoggerConfiguration}} objects on the stack.
> 2. If possible, we should also make the ownership of {{LoggerConfiguration}} 
> clearer in the production use cases.  Currently, we use it as a singleton, 
> via the {{getInstance}} method.  It would be better to have a clear 
> (non-static) owner for it, and users got a reference or pointer to 
> {{LoggerConfiguration}} from the owner.  Then we could remove 
> {{getInstance}}, as well.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to