File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes Accessing an HASingleton subclass Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Accessing an HASingleton subclass" Watch "Accessing an HASingleton subclass" New topic

Accessing an HASingleton subclass

akhil achuthan
Ranch Hand

Joined: Mar 29, 2006
Posts: 69
Im using a clustered JBoss4.2.3GA environment. To attain the singleton behaviour im having a class say 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

Joined: Jul 20, 2005
Posts: 10441

How are you deploying that class? I mean, how does JBoss AS know, that it has to use that class?

[My Blog] [JavaRanch Journal]
akhil achuthan
Ranch Hand

Joined: Mar 29, 2006
Posts: 69
I have it configured it inside my jboss-service.xml within a .sar file. The snippet is given below.

<mbean code="" name=",component=jive">

Actually my ControlInitBean is a HASingletonSupport class.
akhil achuthan
Ranch Hand

Joined: Mar 29, 2006
Posts: 69
Got a reference over the net

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...
I agree. Here's the link:
subject: Accessing an HASingleton subclass
It's not a secret anymore!