Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing an HASingleton subclass

 
akhil achuthan
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • 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
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic