Author: sebawagner Date: Sun Apr 15 15:25:41 2012 New Revision: 1326363 URL: http://svn.apache.org/viewvc?rev=1326363&view=rev Log: OPENMEETINGS-169 Clean up WhiteBoardService to use proper sync methods
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/WhiteBoardService.java
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/WhiteBoardService.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/WhiteBoardService.java?rev=1326363&r1=1326362&r2=1326363&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/WhiteBoardService.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/WhiteBoardService.java
Sun Apr 15 15:25:41 2012
@@ -21,14 +21,12 @@ package org.openmeetings.app.remote;
import java.io.File;
import java.io.FilenameFilter;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
-import java.util.Set;
import org.apache.commons.collections.ComparatorUtils;
import org.openmeetings.app.conference.session.RoomClient;
@@ -49,7 +47,6 @@ import org.red5.server.api.IScope;
import org.red5.server.api.Red5;
import org.red5.server.api.service.IPendingServiceCall;
import org.red5.server.api.service.IPendingServiceCallback;
-import org.red5.server.api.service.IServiceCapableConnection;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -403,32 +400,9 @@ public class WhiteBoardService implement
syncListRoom.put(currentClient.getPublicSID(),
wSyncLockObject);
this.whiteBoardObjectListManager.setWhiteBoardSyncListByRoomid(
room_id, syncListRoom);
-
- Collection<Set<IConnection>> conCollection =
current.getScope()
- .getConnections();
- for (Set<IConnection> conset : conCollection) {
- for (IConnection conn : conset) {
- if (conn != null) {
- if (conn instanceof
IServiceCapableConnection) {
- RoomClient rcl =
this.clientListManager
-
.getClientByStreamId(conn.getClient()
-
.getId());
- if
(rcl.getIsScreenClient() != null
- &&
rcl.getIsScreenClient()) {
- // continue;
- } else {
- if (room_id !=
null
-
&& room_id.equals(rcl.getRoom_id())) {
-
((IServiceCapableConnection) conn).invoke(
-
"sendSyncFlag",
-
new Object[] { wSyncLockObject },
-
this);
- }
- }
- }
- }
- }
- }
+
+ //Sync to clients
+
this.scopeApplicationAdapter.syncMessageToCurrentScope("sendSyncFlag",
wSyncLockObject, true);
return wSyncLockObject;
@@ -470,32 +444,7 @@ public class WhiteBoardService implement
.getNumberOfInitialLoaders(syncListRoom);
if (numberOfInitial == 0) {
- Collection<Set<IConnection>>
conCollection = current
-
.getScope().getConnections();
- for (Set<IConnection> conset :
conCollection) {
- for (IConnection conn : conset)
{
- if (conn != null) {
- if (conn
instanceof IServiceCapableConnection) {
-
RoomClient rcl = this.clientListManager
-
.getClientByStreamId(conn
-
.getClient().getId());
- if
(rcl.getIsScreenClient() != null
-
&& rcl.getIsScreenClient()) {
-
// continue;
- } else {
-
if (room_id != null
-
&& room_id.equals(rcl
-
.getRoom_id())) {
-
((IServiceCapableConnection) conn)
-
.invoke("sendSyncCompleteFlag",
-
new Object[] { wSyncLockObject },
-
this);
-
}
- }
- }
- }
- }
- }
+
this.scopeApplicationAdapter.syncMessageToCurrentScope("sendSyncCompleteFlag",
wSyncLockObject, true);
} else {
return;
}
@@ -552,33 +501,7 @@ public class WhiteBoardService implement
// Do only send the Token to show the Loading Splash
for the
// initial-Request that starts the loading
if (isStarting) {
- Collection<Set<IConnection>> conCollection =
current.getScope()
- .getConnections();
- for (Set<IConnection> conset : conCollection) {
- for (IConnection conn : conset) {
- if (conn != null) {
- if (conn instanceof
IServiceCapableConnection) {
- RoomClient rcl
= this.clientListManager
-
.getClientByStreamId(conn.getClient()
-
.getId());
- if
(rcl.getIsScreenClient() != null
-
&& rcl.getIsScreenClient()) {
- //
continue;
- } else {
-
log.debug("sending :" + rcl);
- if
(room_id != null
-
&& room_id.equals(rcl.getRoom_id())) {
-
log.debug("sendObjectSyncFlag :" + rcl);
-
((IServiceCapableConnection) conn)
-
.invoke("sendObjectSyncFlag",
-
new Object[] { wSyncLockObject },
-
this);
- }
- }
- }
- }
- }
- }
+
this.scopeApplicationAdapter.syncMessageToCurrentScope("sendObjectSyncFlag",
wSyncLockObject, true);
}
} catch (Exception err) {
@@ -631,35 +554,7 @@ public class WhiteBoardService implement
+ numberOfInitial);
if (numberOfInitial == 0) {
- int returnVal = 0;
- Collection<Set<IConnection>>
conCollection = current
-
.getScope().getConnections();
- for (Set<IConnection> conset :
conCollection) {
- for (IConnection conn : conset)
{
- if (conn != null) {
- if (conn
instanceof IServiceCapableConnection) {
-
RoomClient rcl = this.clientListManager
-
.getClientByStreamId(conn
-
.getClient().getId());
- if
(rcl.getIsScreenClient() != null
-
&& rcl.getIsScreenClient()) {
-
// continue;
- } else {
-
if (room_id != null
-
&& room_id.equals(rcl
-
.getRoom_id())) {
-
returnVal++;
-
((IServiceCapableConnection) conn)
-
.invoke("sendObjectSyncCompleteFlag",
-
new Object[] { wSyncLockObject },
-
this);
-
}
- }
- }
- }
- }
- }
- return returnVal;
+ return
scopeApplicationAdapter.syncMessageToCurrentScope("sendObjectSyncCompleteFlag",
wSyncLockObject, true);
} else {
return -4;
}
@@ -705,35 +600,9 @@ public class WhiteBoardService implement
log.debug("scope " + scope);
if (numberOfInitial == 0 && scope != null) {
- Collection<Set<IConnection>>
conCollection = scope
- .getConnections();
- for (Set<IConnection> conset :
conCollection) {
- for (IConnection conn : conset)
{
- if (conn != null) {
- if (conn
instanceof IServiceCapableConnection) {
-
RoomClient rcl = this.clientListManager
-
.getClientByStreamId(conn
-
.getClient().getId());
- if (rcl
!= null) {
-
if (rcl.getIsScreenClient() != null
-
&& rcl.getIsScreenClient()) {
-
// continue;
-
} else {
-
if (!rcl.getPublicSID().equals(
-
currentClient
-
.getPublicSID())) {
-
// do not send to current
-
((IServiceCapableConnection) conn)
-
.invoke("sendSyncCompleteFlag",
-
new Object[] { wSyncLockObject
},
-
this);
-
}
-
}
- }
- }
- }
- }
- }
+
+
scopeApplicationAdapter.syncMessageToCurrentScope("sendSyncCompleteFlag",
wSyncLockObject, false);
+
}
// Check Image Loaders
@@ -759,30 +628,7 @@ public class WhiteBoardService implement
.getWhiteBoardObjectSyncListByRoomid(room_id).size();
if (numberOfImageLoaders == 0 && scope != null)
{
- Collection<Set<IConnection>>
conCollection = scope
- .getConnections();
- for (Set<IConnection> conset :
conCollection) {
- for (IConnection conn : conset)
{
- if (conn != null) {
- if (conn
instanceof IServiceCapableConnection) {
-
RoomClient rcl = this.clientListManager
-
.getClientByStreamId(conn
-
.getClient().getId());
- if
(rcl.getIsScreenClient() != null
-
&& rcl.getIsScreenClient()) {
-
// continue;
- } else {
-
if (rcl != null) {
-
((IServiceCapableConnection) conn)
-
.invoke("sendImagesSyncCompleteFlag",
-
new Object[] { "remove" },
-
this);
-
}
- }
- }
- }
- }
- }
+
scopeApplicationAdapter.syncMessageToCurrentScope("sendImagesSyncCompleteFlag",
new Object[] { "remove" }, true);
}
}
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java?rev=1326363&r1=1326362&r2=1326363&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java
Sun Apr 15 15:25:41 2012
@@ -2310,7 +2310,7 @@ public class ScopeApplicationAdapter ext
* @param sendSelf
* @return
*/
- private synchronized int syncMessageToCurrentScope(String
remoteMethodName, Object newMessage, boolean sendSelf) {
+ public synchronized int syncMessageToCurrentScope(String
remoteMethodName, Object newMessage, boolean sendSelf) {
try {
IConnection current = Red5.getConnectionLocal();
