Exemplo n.º 1
0
  @Override
  public void closeSessions(String principalName, String principalClassName) throws Exception {
    if ((principalName == null)
        || (principalName.trim().length() == 0)
        || (principalClassName == null)
        || (principalClassName.trim().length() == 0)) {
      return;
    }

    principalName = principalName.trim();
    principalClassName = principalClassName.trim();

    Map<Long, Map<String, String>> sessionPrincipalMap =
        serviceManagementBean.getLoggedInSessions();

    for (Map.Entry<Long, Map<String, String>> entry : sessionPrincipalMap.entrySet()) {
      long sessionId = entry.getKey();
      Map<String, String> userPrincipals = entry.getValue();

      for (Map.Entry<String, String> principal : userPrincipals.entrySet()) {
        String key = principal.getKey();
        String value = principal.getValue();

        // Case sensitive for both name and class-name.
        if (key.equals(principalName) && (value.equals(principalClassName))) {
          SessionMXBean sessionBean = managementServiceHandler.getSessionMXBean(sessionId);
          sessionBean.close();
          serviceManagementBean.removeSessionManagementBean(sessionId);
          break;
        }
      }
    }
  }
Exemplo n.º 2
0
  @Override
  public Map<String, String> getUserPrincipals(Long sessionId) {
    // First, get the map of session ID to user principals for that session.
    Map<Long, Map<String, String>> sessionPrincipalMap =
        serviceManagementBean.getLoggedInSessions();

    if (sessionPrincipalMap != null) {
      for (Map.Entry<Long, Map<String, String>> entry : sessionPrincipalMap.entrySet()) {
        if (entry.getKey() == sessionId.longValue()) {
          return entry.getValue();
        }
      }
    }

    return null;
  }
Exemplo n.º 3
0
  /**
   * 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.
   */
  @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;
  }
Exemplo n.º 4
0
 @Override
 public void restart() throws Exception {
   serviceManagementBean.restart();
 }
Exemplo n.º 5
0
 @Override
 public void stop() throws Exception {
   serviceManagementBean.stop();
 }
Exemplo n.º 6
0
 @Override
 public boolean isHeartbeatRunning() {
   return serviceManagementBean.isHeartbeatRunning();
 }
Exemplo n.º 7
0
 @Override
 public boolean isServiceConnected() {
   return serviceManagementBean.isServiceConnected();
 }
Exemplo n.º 8
0
 @Override
 public int getHeartbeatPingFailuresCount() {
   return serviceManagementBean.getHeartbeatPingFailuresCount();
 }
Exemplo n.º 9
0
 @Override
 public String getLatestException() {
   return serviceManagementBean.getLatestException();
 }
Exemplo n.º 10
0
 @Override
 public long getNumberOfCumulativeEmulatedSessions() {
   return serviceManagementBean.getCumulativeEmulatedSessionCount();
 }
Exemplo n.º 11
0
 @Override
 public long getLastFailedConnectTime() {
   return serviceManagementBean.getLastFailedConnectTime();
 }
Exemplo n.º 12
0
 @Override
 public long getLastSuccessfulConnectTime() {
   return serviceManagementBean.getLastSuccessfulConnectTime();
 }
Exemplo n.º 13
0
 @Override
 public long getTotalBytesSentCount() {
   return serviceManagementBean.getTotalBytesSentCount();
 }
Exemplo n.º 14
0
 @Override
 public void clearCumulativeSessionsCount() {
   serviceManagementBean.clearCumulativeSessionsCount();
 }
Exemplo n.º 15
0
 @Override
 public boolean getLastHeartbeatPingResult() {
   return serviceManagementBean.getLastHeartbeatPingResult();
 }
Exemplo n.º 16
0
 public int getIndex() {
   return serviceManagementBean.getId();
 }
Exemplo n.º 17
0
 @Override
 public long getLastHeartbeatPingTimestamp() {
   return serviceManagementBean.getLastHeartbeatPingTimestamp();
 }
Exemplo n.º 18
0
 @Override
 public long getNumberOfCurrentNativeSessions() {
   return serviceManagementBean.getCurrentNativeSessionCount();
 }
Exemplo n.º 19
0
 @Override
 public long getNumberOfExceptions() {
   return serviceManagementBean.getExceptionCount();
 }