> Hi,
> I would like to run a singleton class as a thread.
[quoted text clipped - 4 lines]
>
> Any help will be valuable!
What you're trying to do is a bit odd.
Singletons are classically made to ensure only one instance exists,
right? So code can call getInstance() and not care.
And so the singleton class itself usually does any setup required for
its inner state.
If in your example you had:
MySingletonClass.getInstance().start();
it wouldn't really make much sense, because if another bit of code had
already called this, you'd get IllegalThreadStateException (because
thread has already started).
The classic thing for a singleton to do is to do any setup required in
getInstance, thus hiding such setup code from the caller of getInstance.
I can't comment much further without knowing what it is you're trying to
achieve here, but why not have the singleton's getInstance method do any
thread stuff that is required?
lex