Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Accessing an HASingleton subclass

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im using a clustered JBoss4.2.3GA environment. To attain the singleton behaviour im having a class say AppHA.java that extends org.jboss.ha.singleton.HASingletonSupport. As this is no normal java class it should not be correct to acess this class by creating a new instance using the new operator( new AppHA() ). Now how do I access a public custom method within this AppHA class?


Thanks in advance
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you deploying that class? I mean, how does JBoss AS know, that it has to use that class?
 
akhil achuthan
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have it configured it inside my jboss-service.xml within a .sar file. The snippet is given below.

<mbean code="net.test.app.akhil.init.ejb.ControlInitBean" name="jnpr.jmp:service=ControlInitBean,component=jive">
<depends>jboss.j2ee:module=inventory.jar,service=EJB3</depends>
</mbean>


Actually my ControlInitBean is a HASingletonSupport class.
 
akhil achuthan
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got a reference over the net

http://community.jboss.org/wiki/WritingaClusteredHASingletonService

I could access the my HASingleton with this approach, but still have a problem. The hash codes printed within the startSingleton() and stopSingleton() are the same for a JVM lifecycle. But for the same lifecycle if I print the hashcode within my custom method that I access using the HA-JNDI lookup, I get a different has code printed. Coz of I doubt if am going the right way...
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic