1 Reply Latest reply on Oct 4, 2006 12:33 PM by alrubinger

    Problems to maintain data in memory EJB

    tallesbrito

      How'd I maintain some instance variables in memory (without persist) in a way that all the clients can acess and modify them?
      I tried to use Stateless bean, but they are pooled, and because of that the attributes of one instance would be different of another.
      Stateful beans would be good, but my attributes need to be shared for all the clients.

      Does anyone know a solution??

        • 1. Re: Problems to maintain data in memory EJB
          alrubinger

          So you need a Singleton with editable instance variables?

          You could pretty easily make a JMX MBean using either a @Service Bean (http://trailblazer.demo.jboss.com/EJB3Trail/serviceobjects/jmx/), or by dropping a "*-service.xml" file into your deploy directory...

          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE server>
          
          <server>
          
           <mbean code="com.you.yourBean"
           name="you:service=ServiceName">
           <attribute name="JNDIName">java:/YourServiceNameInJNDI</attribute>
           <attribute name="prop1">defaultValueProp1</attribute>
           <depends>you:service=ServiceIDependOn</depends>
           </attribute>
           </mbean>
          
          </server>


          S,
          ALR