ugh, yea we are getting ready to implement a cluster so that kills the
singleton idea.  maybe i can modify my class to hold the log entries
in fields and implement either a jms queue or tie it into the database
save method.   i just find it hard to believe that there isn't any way
to implement say a temp session space for each transaction thru the
app server that starts at the beginning of the session and is
destroyed at the end of it.  kinda like session spaces in web servers.

On Mar 29, 3:57 pm, Matthew Biggin <[email protected]>
wrote:
> Couldn't you implement the singleton as an enum with a single element called
> INSTANCE?
>
> That way the JVM enforces the singleton nature of the class. Only problem
> you have in a J2EE app server is that you don't have any control over the
> number of JVMs used. Internally it could implement an arbitrary number of
> them, it could also be clustered.
>
> Singletons don't help you with unit testing so maybe a redesign might be in
> order to remove the need for a singleton in the first place.
>
> m.
>
> On 29 March 2010 20:43, scphantm <[email protected]> wrote:
>
>
>
>
>
> > that does seem like major overkill.  all i really need is something
> > like a thread safe singleton class that can run inside of a JEE app
> > server or something like that.  i don't really need to try to
> > integrate a whole new framework in this thing.
>
> > ive found code that show how to write a thread safe singleton, but all
> > the comments on examples i have seen say they work great except in an
> > app server, all the examples are like this
>
> > if (instance_ == null) {
> >      synchronized(syncObject_) {
> >        if (instance_ == null) {
> >           instance_ = new myclass();
> >        }
> >      }
> >    }
> >    return instance_;
>
> > would that work inside an app server?
>
> > On Mar 29, 12:43 pm, Wayne Fay <[email protected]> wrote:
> > > > Its a middleware application.  basically its an HTTP servlet that
> > > > accepts an XML document from a client and process it.  its deployed as
> > > > a war file on jboss 5.1
>
> > > Perhaps total overkill... but have you considered Mule, OpenESB, WSO2
> > > etc? What you describe is basically their bread and butter, including
> > > the routing, transaction auditing, etc.
>
> > > Wayne
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "The Java Posse" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<javaposse%2bunsubscr...@googlegroups 
> > .com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/javaposse?hl=en.
>
> --
> Matt Biggin

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to