Hi
Thanx, that is what i exactly trying to do , build a
program to work with escape charaters..
apache common-lang is a good set of utilities...
Ashish
--- Davor Cengija <[EMAIL PROTECTED]> wrote:
> Ashish Kulkarni wrote:
>
> > Hi,
> >
> > If I have a class with a static synchronized
> method
> > and a class with singleton pattern doing the same
> > function, wont the 2 be same, what may be the
> > performance issue, what should we use in programs,
> > The method i want to use is synchronized, so that
> no 2
> > classes can access it a time, and hence create
> some
> > weird results.
>
> Basically, you use singletons when you need to
> maintain some state and want
> that initialized only once for the complete
> application. However...
>
> >
> > This is what my classes will look
> > Class with static method
> > public class MyString
> > {
> > public static synchronized String
> > removeEscapeChar(String inputString)
> > {
> > // my logic here
> > }
> > }
>
>
> No need for synchronized method since method itself
> is atomic. If your
> method doesn't use any object outside itself, then
> you don't have to worry
> about the concurrent access.
>
> >
> > Singleton pattern class
> >
> > public class MyString
> > {
> > private static MyString instance;
> > public static MapsContextData getInstance()
> > {
> > return instance;
> > }
> > public String removeEscapeChar(String inputString)
> > {
> > // my logic here
> > }
> >
> > }
> >
>
> Again, if you only have your method doing all the
> work without using any
> other object beside the in-method initialized ones,
> no need for singletons,
> instances etc.
>
> From your example it is not visible what
> removeEscapeChar() does, but it
> looks like a utility class method. Take a look at
> apache commons-lang for
> some examples.
>
> --
> [EMAIL PROTECTED]
>
>
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
=
A$HI$H
__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]