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