- add an api to let us query the user sessions in bbb-web. We use this to see what sessions are hanging around

that may be causing OOM exception on tomcat7
This commit is contained in:
Richard Alam 2015-08-04 17:58:27 +00:00
parent d49435b5d8
commit d140ca0b40
3 changed files with 92 additions and 2 deletions

View File

@ -52,7 +52,12 @@ class UrlMappings {
"/api/getMeetings"(controller:"api") {
action = [GET:'getMeetingsHandler', POST:'getMeetingsHandler']
}
"/api/getSessions"(controller:"api") {
action = [GET:'getSessionsHandler', POST:'getSessionsHandler']
}
"/api/getRecordings"(controller:"api") {
action = [GET:'getRecordingsHandler', POST:'getRecordingsHandler']
}

View File

@ -822,6 +822,87 @@ class ApiController {
}
}
}
/************************************
* GETSESSIONS API
************************************/
def getSessionsHandler = {
String API_CALL = "getSessions"
log.debug CONTROLLER_NAME + "#${API_CALL}"
println("##### GETSESSIONS API CALL ####")
// BEGIN - backward compatibility
if (StringUtils.isEmpty(params.checksum)) {
invalid("checksumError", "You did not pass the checksum security check")
return
}
if (! paramsProcessorUtil.isChecksumSame(API_CALL, params.checksum, request.getQueryString())) {
invalid("checksumError", "You did not pass the checksum security check")
return
}
// END - backward compatibility
ApiErrors errors = new ApiErrors()
// Do we have a checksum? If none, complain.
if (StringUtils.isEmpty(params.checksum)) {
errors.missingParamError("checksum");
}
if (errors.hasErrors()) {
respondWithErrors(errors)
return
}
// Do we agree on the checksum? If not, complain.
if (! paramsProcessorUtil.isChecksumSame(API_CALL, params.checksum, request.getQueryString())) {
errors.checksumError()
respondWithErrors(errors)
return
}
Collection<Meeting> sssns = meetingService.getSessions();
if (sssns == null || sssns.isEmpty()) {
response.addHeader("Cache-Control", "no-cache")
withFormat {
xml {
render(contentType:"text/xml") {
response() {
returncode(RESP_CODE_SUCCESS)
sessions()
messageKey("noSessions")
message("no sessions were found on this server")
}
}
}
}
} else {
println("#### Has sessions [" + sssns.size() + "] #####")
response.addHeader("Cache-Control", "no-cache")
withFormat {
xml {
render(contentType:"text/xml") {
response() {
returncode(RESP_CODE_SUCCESS)
sessions {
for (m in sssns) {
meeting {
meetingID(m.meetingID)
meetingName(m.conferencename)
userName(m.fullname)
}
}
}
}
}
}
}
}
}
def getDefaultConfigXML = {

View File

@ -247,9 +247,13 @@ public class MeetingService implements MessageListener {
return meetings.isEmpty() ? Collections.<Meeting>emptySet() : Collections.unmodifiableCollection(meetings.values());
}
public Collection<UserSession> getSessions() {
log.debug("Num sessions = [" + sessions.size() + "]");
return sessions.isEmpty() ? Collections.<UserSession>emptySet() : Collections.unmodifiableCollection(sessions.values());
}
public void createMeeting(Meeting m) {
handle(new CreateMeeting(m));
// handleCreateMeeting(m);
}
private void handleCreateMeeting(Meeting m) {