Hi Chris,

Actually, most of the existing  Singleton pattern Class is just for
simplifying things during development. And we did run into trouble
when writing some UTs(In such case, I will change related Singleton
pattern Class ).
But there are always higher priority tasks, so there is no time to
change all these singletons. Good news is that we have strictly
controlled the use of singletons in the new PRs, so there should be no
more new ones.

Best,
----------------
Yuan Tian

On Fri, Jul 14, 2023 at 7:14 PM Christofer Dutz
<[email protected]> wrote:
>
> Hi all,
>
> as I’m digging into IoTDB more and more, I noticed a quite excessive usage of 
> the Singleton pattern … some times even for things where it doesn’t really 
> make much sense. For example in SystemFileFactory, the methods don’t really 
> have much state and simply fire RuntimeExceptions if fsType is initialized 
> with HDFS.
>
> Singletons make it a bit tricky to run tests in parallel and to do dynamic 
> reloading of modules (like in OSGI). Most projects I’ve worked on try to 
> limit the use of singletons to an absolute minimum due to these problems.
>
> I guess embedding IoTDB in an OSGI environment hasn’t been a use-case yet, 
> but I could imagine that random test failures while running tests in parallel 
> probably could have caused some issues.
>
> Was this a design decision that is based on some real-world necessity, or for 
> simplifying things during development?
> I don’t want to put too much effort into proposing cleaning up things, if 
> there was a conscious decision to do things otherwise.
>
> Chris
>

Reply via email to