[Red5commits] [1553] fixed endless recursive calls in ApplicationAdapter?

jbauch luke at codegent.com
Wed Jan 24 10:53:11 EST 2007


fixed endless recursive calls in ApplicationAdapter?


Timestamp: 11/16/06 19:57:11 EST (2 months ago) 
Change: 1553 
Author: jbauch

Files (see diff or trac for details): 
java/server/trunk/src/org/red5/server/adapter/ApplicationAdapter.java
java/server/trunk/src/org/red5/server/api/ScopeUtils.java


Trac: http://mirror1.cvsdude.com/trac/osflash/red5/changeset/1553

Index: /java/server/trunk/src/org/red5/server/adapter/ApplicationAdapter.java
===================================================================
--- /java/server/trunk/src/org/red5/server/adapter/ApplicationAdapter.java (revision 1538)
+++ /java/server/trunk/src/org/red5/server/adapter/ApplicationAdapter.java (revision 1553)
@@ -602,5 +602,5 @@
 		ISharedObjectService service = (ISharedObjectService) getScopeService(
 				scope, ISharedObjectService.class,
-				SharedObjectService.class);
+				SharedObjectService.class, false);
 		return service.createSharedObject(scope, name, persistent);
 	}
@@ -618,5 +618,5 @@
 		ISharedObjectService service = (ISharedObjectService) getScopeService(
 				scope, ISharedObjectService.class,
-				SharedObjectService.class);
+				SharedObjectService.class, false);
 		return service.getSharedObject(scope, name);
 	}
@@ -637,5 +637,5 @@
 		ISharedObjectService service = (ISharedObjectService) getScopeService(
 				scope, ISharedObjectService.class,
-				SharedObjectService.class);
+				SharedObjectService.class, false);
 		return service.getSharedObject(scope, name, persistent);
 	}
@@ -650,5 +650,5 @@
 		ISharedObjectService service = (ISharedObjectService) getScopeService(
 				scope, ISharedObjectService.class,
-				SharedObjectService.class);
+				SharedObjectService.class, false);
 		return service.getSharedObjectNames(scope);
 	}
@@ -665,5 +665,5 @@
 		ISharedObjectService service = (ISharedObjectService) getScopeService(
 				scope, ISharedObjectService.class,
-				SharedObjectService.class);
+				SharedObjectService.class, false);
 		return service.hasSharedObject(scope, name);
 	}
@@ -737,5 +737,5 @@
 		IOnDemandStreamService service = (IOnDemandStreamService) getScopeService(
 				scope, IOnDemandStreamService.class,
-				StreamService.class);
+				StreamService.class, false);
 		return service.getOnDemandStream(scope, name);
 	}
@@ -757,5 +757,5 @@
 		ISubscriberStreamService service = (ISubscriberStreamService) getScopeService(
 				scope, ISubscriberStreamService.class,
-				StreamService.class);
+				StreamService.class, false);
 		return service.getSubscriberStream(scope, name);
 	}
@@ -776,5 +776,5 @@
 		ISchedulingService service = (ISchedulingService) getScopeService(
 				scope, ISchedulingService.class,
-				QuartzSchedulingService.class);
+				QuartzSchedulingService.class, false);
 		return service.addScheduledJob(interval, job);
 	}
@@ -795,5 +795,5 @@
 		ISchedulingService service = (ISchedulingService) getScopeService(
 				scope, ISchedulingService.class,
-				QuartzSchedulingService.class);
+				QuartzSchedulingService.class, false);
 		return service.addScheduledOnceJob(timeDelta, job);
 	}
@@ -813,5 +813,5 @@
 		ISchedulingService service = (ISchedulingService) getScopeService(
 				scope, ISchedulingService.class,
-				QuartzSchedulingService.class);
+				QuartzSchedulingService.class, false);
 		return service.addScheduledOnceJob(date, job);
 	}
@@ -826,5 +826,5 @@
 		ISchedulingService service = (ISchedulingService) getScopeService(
 				scope, ISchedulingService.class,
-				QuartzSchedulingService.class);
+				QuartzSchedulingService.class, false);
 		service.removeScheduledJob(name);
 	}
@@ -838,5 +838,5 @@
 		ISchedulingService service = (ISchedulingService) getScopeService(
 				scope, ISchedulingService.class,
-				QuartzSchedulingService.class);
+				QuartzSchedulingService.class, false);
 		return service.getScheduledJobNames();
 	}
Index: /java/server/trunk/src/org/red5/server/api/ScopeUtils.java
===================================================================
--- /java/server/trunk/src/org/red5/server/api/ScopeUtils.java (revision 1542)
+++ /java/server/trunk/src/org/red5/server/api/ScopeUtils.java (revision 1553)
@@ -257,4 +257,8 @@
 	}
 	
+	public static Object getScopeService(IScope scope, Class intf, boolean checkHandler) {
+		return getScopeService(scope, intf, null, checkHandler);
+	}
+
 	/**
 	 * Returns scope service that implements a given interface.
@@ -270,4 +274,9 @@
 	public static Object getScopeService(IScope scope, Class intf,
 			Class defaultClass) {
+		return getScopeService(scope, intf, defaultClass, true);
+	}
+	
+	public static Object getScopeService(IScope scope, Class intf,
+			Class defaultClass, boolean checkHandler) {
 		if (scope == null || intf == null) {
 			return null;
@@ -284,16 +293,18 @@
 
 		Object handler = null;
-		IScope current = scope;
-		while (current != null) {
-			IScopeHandler scopeHandler = current.getHandler();
-			if (intf.isInstance(scopeHandler)) {
-				handler = scopeHandler;
-				break;
-			}
-			
-			if (!current.hasParent())
-				break;
-			
-			current = current.getParent();
+		if (checkHandler) {
+			IScope current = scope;
+			while (current != null) {
+				IScopeHandler scopeHandler = current.getHandler();
+				if (intf.isInstance(scopeHandler)) {
+					handler = scopeHandler;
+					break;
+				}
+				
+				if (!current.hasParent())
+					break;
+				
+				current = current.getParent();
+			}
 		}
 		


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