Não foi possível encontrar esta entrada. Mostrando resultados aproximados. Verifique a ortografia ou proponha a adição deste termo ao dicionário.
单件模式
In the process of writing the code, We will meet when the need to ensure that only one instance of the global, This time use the singleton pattern.
在写代码的过程当中,我们总会遇到需要保证全局只有一个实例的时候,这个时候就要使用单件模式。
The Singleton pattern is used in the design of logger classes.
单件模式被用在日志记录类中。
What about how to implement the singleton pattern? We take a look at the classic Java code, How to implement the singleton pattern.
那么怎么实现单件模式呢?我们来看看最经典的 Java 代码,该怎么实现这个 单件模式。
Since it is thread safe by design, you might cache it in a public static final variable, or wrap it in a singleton pattern after creation for later access.
It is typically used to reduce locking overhead when implementing "lazy initialization" in a multi-threaded environment, especially as part of the Singleton pattern.
它通常用于减少加锁开销,尤其是为多线程环境中的单例模式 实现"惰性初始化 "。
Conteúdo potencialmente sensível ou impróprio
Os exemplos servem apenas como ajuda na tradução da palavra ou da expressão procurada. Eles não são selecionados ou validados por nós e podem conter linguagem inapropriada. Pedimos que reporte exemplos que devem ser modificados ou que não devem ser exibidos. As traduções potencialmente sensivéis, impróprias ou coloquiais geralmente são marcadas em vermelho ou em laranja.