Top "Singleton" questions

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

Get application context from non activity singleton class

In my android project, I have ImageAdapter class in which I pass app context for some further needs. public class …

java android singleton baseadapter android-context
Java best practice: Class with only static methods

I have an application where I have a class called PlausibilityChecker. This class has only static methods, like checkZipcodeFormat or …

java static singleton nio
get_instance() in Codeigniter: Why assign it to a variable?

In Codeigniter, get_instance() is a globally available function that returns the Controller super-object which contains all the currently loaded …

php codeigniter singleton reference
How to deal with Singleton along with Serialization

Consider I have a Singleton class defined as follows. public class MySingleton implements Serializable{ private static MySingleton myInstance; private MySingleton(){ } …

java singleton
Double Checked Locking in Singleton

here is my custom class for singleton pattern. in this code, I use double-checked locking as below. As I read …

java multithreading design-patterns singleton
WPF Single Instance Best Practices

This is the code I implemented so far to create a single instance WPF application: #region Using Directives using System; …

c# wpf singleton mutex
Singleton pattern in C++

I have a question about the singleton pattern. I saw two cases concerning the static member in the singleton class. …

c++ singleton
Using Singleton design pattern for SQLiteDatabase

I'm rather newbie on Android, and I'm working on a simple application to get some basic experience. My app is …

java android sqlite singleton android-loadermanager
Singleton by Jon Skeet clarification

public sealed class Singleton { Singleton() {} public static Singleton Instance { get { return Nested.instance; } } class Nested { // Explicit static constructor to tell …

c# .net design-patterns architecture singleton
Is Spring @autowired not meant for non-singleton containers?

I have a MyTask class which implements Runnable and there can be many such objects instantiated at any given moment. …

spring singleton spring-aop autowired