» Home » Singleton » Page 1
Does calling GetInstance on a Singleton lifetime mapping return the singleton or create a new instance?
Category : Programming Languages

I have the following mapping in ObjectFactory.Initialize method:


expression.For<IFoo>().Singleton()
.Use<SomeFoo>()
.Ctor<string>("url").Is(<fetch from config>)
.Ctor<string>("username").Is(<fetch from config>)

This ensures that my


View Replies


Prevent a subclass of a singleton class from calling the singleton's constructor
Category : Programming Languages

Ok, I have a singleton class GraphMaster which contains a number of system-wide values. I have a subclass GraphObject : GraphMaster which has graph specific data. By subclassing, I can access members of either the global class or subclass. And by using a singleton class, I can change the global variables anywhere and have them be reflected in all the subclasses.


View Replies


Plain old singleton or spring singleton bean?
Category : Development Tools & Services

I have a service in my application which is a singleton.
My application is being bloated with the use of spring framework.


I am confused over to use the singleton service as


1: Plain Old Singleton [Access them statically when required]


OR as a


2: Spring singleton bean. [Use DI to inject when required]


Which approach is correct ?

View Replies


Patterns: Local Singleton vs. Global Singleton?
Category : Programming Languages

There is a pattern that I use from time to time, but I'm not quite sure what it is called. I was hoping that the SO community could help me out.


The pattern is pretty simple, and consists of two parts:


A factory method that creates objects based on the arguments passed in.


Objects created by the factory.


So far this is just a standard "factory" p


View Replies


please help me Assignment has more non-singleton rhs dimensions than non-singleton
Category : Programming Languages

I have the following error in my code


Assignment has more non-singleton rhs
dimensions than non-singleton


This is the code:


string =['d:facefaceffw' int2str(r) '_' int2str(Sel(nSelRow,t)) '.bmp'];
A = imread(string);
B = im2double(A);
Train_Dat(:,:,s)=B;

Update 1:

When I updated the code we got new err


View Replies


Attempt to use my singleton that references another singleton
Category : Programming Languages

I'm calling my custom factory that I created (PhotoServiceFactory), which is a singleton that allows me to get at a specific custom service type back (in this case FacebookService). FacebookService is also a singleton. In FacebookService I've exposed an instance of FacebookAlbumPhoto through a property. I did this because then I don't have to have a ton of the same code over and over again c


View Replies


Referencing singleton body to singleton body without namespacing, but how?
Category : Web Design

My goal ist to reference a function into an singleton/object body!


#


This result is my goal:


var singletonObj_1 = (function () {
return {
custom_fn1 : function(){...},
custom_fn2 : function(){...} <<-- *But Imported
}
})();

So after importing, i am able to call


View Replies


How to call a WCF singleton service within a WCF singleton service without hanging?
Category : Programming Languages

I have two services, one that calls another. Both are marked as singletons as follows:


[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,
ConcurrencyMode = ConcurrencyMode.Multiple)]
public class Service : IService

And I set these up with a ServiceHost as follows:


ServiceHost serviceHost = new ServiceHost(singleto

View Replies


How do I call another Singleton bean from a Singleton bean?
Category : Programming Languages

I've tried putting the remote interface of another Singleton bean into another. However, the remote object will always be null. Is there any other way I could get around it?


@Singleton
public class SingletonBean1 implements SingletonBean1Remote {
@EJB
SingletonBean2Remote singletonBean2Remote;
...
public SingletonBean1() {
...

View Replies


Not quite a Singleton
Category : Web Design

I'm using ActionScript3 to develop a Data Access Layer for an application another developer is working on in my team. One of the objects, lets call it User is expensive to construct. Each user has a unique ID number so I can tell if they've been created before or not, and all User objects are stored in an array somewhere else.


I want to be able to restrict


View Replies

TAGS : quite Singleton

Next
2012 / 2017 Copyrights BigHow , All Rights Reserved .