How to get connected EJB client details in EJB Server running on JBoss EAP 7.2

Viewed 103

I am working on an EJB application where server ear is deployed on JBoss EAP 7.2 and client is standalone client developed using Swing.

We have a requirement to check the active EJB client(who are accessing EJB's server ear) in JBoss EAP 7.2 instances so that if any client is not active, JBoss server application can release the resources created by client application.

I have tried below code with JMX options in JBoss server but could not find the correct object name which can provide active client information.

     ObjectName mBeanName = new ObjectName( "jboss.as:deployment=myapplication.ear");
     MBeanServer connection = ManagementFactory.getPlatformMBeanServer();
     System.out.println("Value via JMX: beancount: " + connection.getMBeanCount());
     MBeanInfo mBeanInfo = connection.getMBeanInfo( mBeanName);
     System.out.println("Value via JMX: bean attributes: " + mBeanInfo.getAttributes());

Is there any way in JBoss server to get this information or do I have to implement heartbeat kind of mechanism in EJB client which will ping server application after some interval to inform that client is alive?

0 Answers
Related