You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2014/12/14 18:15:52 UTC
svn commit: r1645472 - in
/openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/remote:
MobileService.java red5/ScopeApplicationAdapter.java
Author: solomax
Date: Sun Dec 14 17:15:52 2014
New Revision: 1645472
URL: http://svn.apache.org/r1645472
Log:
[OPENMEETINGS-954] mobile service is updated to send audio-only flag; number of synchronized methods in ScopeApplicationAdapter is reduced
Modified:
openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/remote/MobileService.java
openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
Modified: openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/remote/MobileService.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/remote/MobileService.java?rev=1645472&r1=1645471&r2=1645472&view=diff
==============================================================================
--- openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/remote/MobileService.java (original)
+++ openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/remote/MobileService.java Sun Dec 14 17:15:52 2014
@@ -147,6 +147,7 @@ public class MobileService {
room.put("first", first);
room.put("users", sessionManager.getClientListByRoom(r.getRooms_id()).size());
room.put("total", r.getNumberOfPartizipants());
+ room.put("audioOnly", Boolean.TRUE.equals(r.getIsAudioOnly()));
result.add(room);
}
Modified: openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java?rev=1645472&r1=1645471&r2=1645472&view=diff
==============================================================================
--- openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java (original)
+++ openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java Sun Dec 14 17:15:52 2014
@@ -114,12 +114,12 @@ public class ScopeApplicationAdapter ext
private static AtomicLong broadCastCounter = new AtomicLong(0);
- public synchronized void resultReceived(IPendingServiceCall arg0) {
+ public void resultReceived(IPendingServiceCall arg0) {
// TODO Auto-generated method stub
}
@Override
- public synchronized boolean appStart(IScope scope) {
+ public boolean appStart(IScope scope) {
try {
OmFileHelper.setOmHome(scope.getResource("/").getFile());
@@ -491,7 +491,7 @@ public class ScopeApplicationAdapter ext
* Exit Room by Application
*
*/
- public synchronized void logicalRoomLeave() {
+ public void logicalRoomLeave() {
log.debug("logicalRoomLeave ");
try {
IConnection current = Red5.getConnectionLocal();
@@ -517,7 +517,7 @@ public class ScopeApplicationAdapter ext
* @param currentClient
* @param currentScope
*/
- public synchronized void roomLeaveByScope(Client currentClient, IScope currentScope, boolean removeUserFromSessionList) {
+ public void roomLeaveByScope(Client currentClient, IScope currentScope, boolean removeUserFromSessionList) {
try {
log.debug("currentClient " + currentClient);
Long room_id = currentClient.getRoom_id();
@@ -625,7 +625,7 @@ public class ScopeApplicationAdapter ext
* @see org.red5.server.adapter.MultiThreadedApplicationAdapter#streamPublishStart(org.red5.server.api.stream.IBroadcastStream)
*/
@Override
- public synchronized void streamPublishStart(IBroadcastStream stream) {
+ public void streamPublishStart(IBroadcastStream stream) {
try {
log.debug("----------- streamPublishStart");
IConnection current = Red5.getConnectionLocal();
@@ -720,7 +720,7 @@ public class ScopeApplicationAdapter ext
* @see org.red5.server.adapter.MultiThreadedApplicationAdapter#streamBroadcastClose(org.red5.server.api.stream.IBroadcastStream)
*/
@Override
- public synchronized void streamBroadcastClose(IBroadcastStream stream) {
+ public void streamBroadcastClose(IBroadcastStream stream) {
// Notify all the clients that the stream had been closed
log.debug("start streamBroadcastClose broadcast close: " + stream.getPublishedName());
@@ -855,31 +855,13 @@ public class ScopeApplicationAdapter ext
Map cursor = (Map) item;
cursor.put("streamPublishName", currentClient.getStreamPublishName());
- // Notify all users of the same Scope
- for (IConnection conn : current.getScope().getClientConnections()) {
- if (conn != null) {
- if (conn instanceof IServiceCapableConnection) {
- IClient client = conn.getClient();
- if (SessionVariablesUtil.isScreenClient(client)) {
- // screen sharing clients do not receive events
- continue;
- } else if (SessionVariablesUtil.isAVClient(client)) {
- // AVClients or potential AVClients do not receive events
- continue;
- } if (client.getId().equals(current.getClient().getId())) {
- // don't send back to same user
- continue;
- }
- ((IServiceCapableConnection) conn).invoke("newRed5ScreenCursor", new Object[] { cursor }, this);
- }
- }
- }
+ syncMessageToCurrentScope("newRed5ScreenCursor", cursor, true, false);
} catch (Exception err) {
log.error("[setNewCursorPosition]", err);
}
}
- public synchronized Long removeModerator(String publicSID) {
+ public Long removeModerator(String publicSID) {
try {
log.debug("----------- removeModerator: " + publicSID);
@@ -899,35 +881,17 @@ public class ScopeApplicationAdapter ext
List<Client> currentMods = sessionManager.getCurrentModeratorByRoom(room_id);
- // Notify all clients of the same scope (room)
- for (IConnection conn : current.getScope().getClientConnections()) {
- if (conn != null) {
- if (conn instanceof IServiceCapableConnection) {
- IClient client = conn.getClient();
- if (SessionVariablesUtil.isScreenClient(client)) {
- // screen sharing clients do not receive events
- continue;
- } else if (SessionVariablesUtil.isAVClient(client)) {
- // AVClients or potential AVClients do not receive events
- continue;
- }
- ((IServiceCapableConnection) conn).invoke("setNewModeratorByList", new Object[] { currentMods }, this);
- }
- }
- }
+ syncMessageToCurrentScope("setNewModeratorByList", currentMods, true);
} catch (Exception err) {
log.error("[addModerator]", err);
}
return -1L;
}
- public synchronized Long setBroadCastingFlag(String publicSID, boolean value, Integer interviewPodId) {
+ public Long setBroadCastingFlag(String publicSID, boolean value, Integer interviewPodId) {
try {
log.debug("----------- setBroadCastingFlag: " + publicSID);
- IConnection current = Red5.getConnectionLocal();
- // String streamid = current.getClient().getId();
-
Client currentClient = sessionManager.getClientByPublicSID(publicSID, false, null);
if (currentClient == null) {
@@ -941,22 +905,7 @@ public class ScopeApplicationAdapter ext
sessionManager.updateClientByStreamId(currentClient.getStreamid(), currentClient, false, null);
// Notify all clients of the same scope (room)
- for (IConnection conn : current.getScope().getClientConnections()) {
- if (conn != null) {
- if (conn instanceof IServiceCapableConnection) {
- IClient client = conn.getClient();
- if (SessionVariablesUtil.isScreenClient(client)) {
- // screen sharing clients do not receive events
- continue;
- } else if (SessionVariablesUtil.isAVClient(client)) {
- // AVClients or potential AVClients do not receive events
- continue;
- }
-
- ((IServiceCapableConnection) conn).invoke("setNewBroadCastingFlag", new Object[] { currentClient }, this);
- }
- }
- }
+ syncMessageToCurrentScope("setNewBroadCastingFlag", currentClient, true);
} catch (Exception err) {
log.error("[setBroadCastingFlag]", err);
}
@@ -1117,7 +1066,7 @@ public class ScopeApplicationAdapter ext
* @param interviewPodId
* @return RoomClient being updated in case of no errors, null otherwise
*/
- public synchronized Client setUserAVSettings(String avsettings,
+ public Client setUserAVSettings(String avsettings,
Object newMessage, Integer vWidth, Integer vHeight,
long room_id, String publicSID, Integer interviewPodId) {
try {
@@ -1144,21 +1093,7 @@ public class ScopeApplicationAdapter ext
hsm.put("client", currentClient);
hsm.put("message", newMessage);
- for (IConnection conn : current.getScope().getClientConnections()) {
- if (conn != null) {
- if (conn instanceof IServiceCapableConnection) {
- IClient client = conn.getClient();
- if (SessionVariablesUtil.isScreenClient(client)) {
- // screen sharing clients do not receive events
- continue;
- } else if (SessionVariablesUtil.isAVClient(client)) {
- // AVClients or potential AVClients do not receive events
- continue;
- }
- ((IServiceCapableConnection)conn).invoke("sendVarsToMessageWithClient", new Object[] { hsm }, this);
- }
- }
- }
+ syncMessageToCurrentScope("sendVarsToMessageWithClient", hsm, true);
return currentClient;
} catch (Exception err) {
log.error("[setUserAVSettings]", err);
@@ -1734,12 +1669,11 @@ public class ScopeApplicationAdapter ext
}
}
- public synchronized int sendVarsModeratorGeneral(Object vars) {
+ public int sendVarsModeratorGeneral(Object vars) {
log.debug("*..*sendVars: " + vars);
try {
IConnection current = Red5.getConnectionLocal();
- Client currentClient = this.sessionManager
- .getClientByStreamId(current.getClient().getId(), null);
+ Client currentClient = sessionManager.getClientByStreamId(current.getClient().getId(), null);
// Long room_id = currentClient.getRoom_id();
log.debug("***** id: " + currentClient.getStreamid());
@@ -1749,24 +1683,7 @@ public class ScopeApplicationAdapter ext
if (ismod) {
log.debug("CurrentScope :" + current.getScope().getName());
// Send to all Clients of the same Scope
- for (IConnection conn : current.getScope().getClientConnections()) {
- if (conn != null) {
- if (conn instanceof IServiceCapableConnection) {
- IClient client = conn.getClient();
- if (SessionVariablesUtil.isScreenClient(client)) {
- // screen sharing clients do not receive events
- continue;
- } else if (SessionVariablesUtil.isAVClient(client)) {
- // AVClients or potential AVClients do not receive events
- continue;
- } if (client.getId().equals(current.getClient().getId())) {
- // don't send back to same user
- continue;
- }
- ((IServiceCapableConnection) conn).invoke("sendVarsToModeratorGeneral", new Object[] { vars },this);
- }
- }
- }
+ syncMessageToCurrentScope("sendVarsToModeratorGeneral", vars, false);
return 1;
} else {
// log.debug("*..*you are not allowed to send: "+ismod);
@@ -2459,7 +2376,7 @@ public class ScopeApplicationAdapter ext
return null;
}
- public synchronized void setSipTransport(Long room_id, String publicSID, String broadCastId) {
+ public void setSipTransport(Long room_id, String publicSID, String broadCastId) {
log.debug("----------- setSipTransport");
IConnection current = Red5.getConnectionLocal();
IClient c = current.getClient();
@@ -2480,26 +2397,6 @@ public class ScopeApplicationAdapter ext
sessionManager.updateClientByStreamId(streamid, currentClient, false, null);
SessionVariablesUtil.initClient(c, false, publicSID);
- for (IConnection conn : current.getScope().getClientConnections()) {
- if (conn != null) {
- IClient client = conn.getClient();
- if (SessionVariablesUtil.isScreenClient(client)) {
- // screen sharing clients do not receive events
- continue;
- } else if (SessionVariablesUtil.isAVClient(client)) {
- // AVClients or potential AVClients do not receive events
- continue;
- }
-
- if (!client.getId().equals(streamid)) {
- // It is not needed to send back that event to the actual Moderator
- // as it will be already triggered in the result of this Function in the Client
- if (conn instanceof IServiceCapableConnection) {
- ((IServiceCapableConnection) conn).invoke("addNewUser", new Object[] { currentClient }, this);
- log.debug("sending setSipTransport to " + conn);
- }
- }
- }
- }
+ syncMessageToCurrentScope("addNewUser", currentClient, false);
}
}