[Red5commits] [2446] no need for temporary Set in BaseConnection?simplified code in ClientRegistry?
jbauch
luke at codegent.com
Tue Oct 30 23:51:22 PDT 2007
no need for temporary Set in BaseConnection?
simplified code in ClientRegistry? a bit
Timestamp: 10/25/07 18:22:45 EST (5 days ago)
Change: 2446
Author: jbauch
Files (see diff or trac for details):
java/server/trunk/src/org/red5/server/BaseConnection.java
java/server/trunk/src/org/red5/server/ClientRegistry.java
Trac: http://mirror1.cvsdude.com/trac/osflash/red5/changeset/2446
Index: /java/server/trunk/src/org/red5/server/ClientRegistry.java
===================================================================
--- /java/server/trunk/src/org/red5/server/ClientRegistry.java (revision 2402)
+++ /java/server/trunk/src/org/red5/server/ClientRegistry.java (revision 2446)
@@ -63,8 +63,10 @@
public Client getClient(String id) throws ClientNotFoundException {
- if (!hasClient(id)) {
+ final Client result = (Client) clients.get(id);
+ if (result == null) {
throw new ClientNotFoundException(id);
}
- return (Client) clients.get(id);
+
+ return result;
}
@@ -125,9 +127,5 @@
*/
public IClient lookupClient(String id) throws ClientNotFoundException {
- if (!hasClient(id)) {
- throw new ClientNotFoundException(id);
- }
-
- return clients.get(id);
+ return getClient(id);
}
Index: /java/server/trunk/src/org/red5/server/BaseConnection.java
===================================================================
--- /java/server/trunk/src/org/red5/server/BaseConnection.java (revision 2434)
+++ /java/server/trunk/src/org/red5/server/BaseConnection.java (revision 2446)
@@ -27,4 +27,5 @@
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
import org.red5.server.api.IBasicScope;
@@ -118,5 +119,5 @@
* Set of basic scopes.
*/
- protected Set<IBasicScope> basicScopes;
+ protected Set<IBasicScope> basicScopes = new CopyOnWriteArraySet<IBasicScope>();
/**
@@ -149,5 +150,4 @@
this.sessionId = sessionId;
this.params = params;
- this.basicScopes = new HashSet<IBasicScope>();
}
@@ -301,7 +301,5 @@
try {
// Unregister all child scopes first
- Set<IBasicScope> tmpScopes = new HashSet<IBasicScope>(
- basicScopes);
- for (IBasicScope basicScope : tmpScopes) {
+ for (IBasicScope basicScope : basicScopes) {
unregisterBasicScope(basicScope);
}
Note:
Diffs are chopped if more than 25k.
This is to get past the limit on the mailing list.
More information about the Red5commits
mailing list