Top "Singleton" questions

A design pattern that ensures that exactly one application-wide instance of a particular class exists.

Singleton in Cluster environment

What is the best strategy to refactor a Singleton object to a cluster environment? We use Singleton to cache some …

java singleton websphere cluster-computing
What exactly is the singleton class in ruby?

Is the singleton class in Ruby a class in and of itself? Is it the reason why all objects belong …

ruby oop singleton
Is there an "Empty List" singleton in C#?

In C# I use LINQ and IEnumerable a good bit. And all is well-and-good (or at least mostly so). However, …

c# singleton ienumerable empty-list
@staticmethod with @property

I want Stats.singleton.twitter_count += 1 and I thought I could do class Stats: singleton_object = None @property @staticmethod def …

python singleton properties
ASP.NET Core initialize singleton after configuring DI

So let's say I have a singleton class instance that I register in the DI like this: services.AddSingleton<…

c# asp.net-core dependency-injection singleton
Getting a reference to the UIApplication delegate

I'm writing my first iPhone application and I'm having trouble switching views. I have 2 views and a reference to each …

iphone objective-c singleton delegates uiapplication
Is it a good practice to have logger as a singleton?

I had a habit to pass logger to constructor, like: public class OrderService : IOrderService { public OrderService(ILogger logger) { } } But that …

c# .net logging dependency-injection singleton
Guice eager/lazy singleton instantiations

I'm having some troubles understanding how Guice's singleton instantiations works. I've read the available documentation (here - http://code.google.…

java singleton guice eager
How to mock an enum singleton class using Mockito/Powermock?

I am unsure on how to mock an enum singleton class. public enum SingletonObject{ INSTANCE; private int num; protected setNum(…

java enums singleton mockito powermock
Using RequireJS, how do I pass in global objects or singletons around?

Let's say I am writing code at the main page level and 2 dependencies require the same instance of an object …

javascript singleton requirejs