@ Override public Map < String , Map < String , String > > getLoggedInSessions ( ) { // First, get the map of session ID to user principals for that session. Map < Long , Map < String , String > > sessionPrincipalMap = serviceManagementBean . getLoggedInSessions ( ) ; Map < String , Map < String , String > > result = new HashMap <> ( ) ; for ( Map . Entry < Long , Map < String , String > > entry : sessionPrincipalMap . entrySet ( ) ) { long sessionId = entry . getKey ( ) ; Map < String , String > userPrincipals = entry . getValue ( ) ; ObjectName sessionMBeanName = managementServiceHandler . getSessionMXBean ( sessionId ) . getObjectName ( ) ; result . put ( sessionMBeanName . toString ( ) , userPrincipals ) ; } return result ; }
Return a map of session mbean names to the user principals for those sessions . The serviceManagementBean stores them as session ID to user principals and we have to convert the session ID to mbean name here . Gross but it s the only way to not have JMX - specific stuff in the ServiceManagementBean .