public IMessageInput GetLiveProviderInput(IScope scope, string name, bool needCreate) { IBasicScope basicScope = scope.GetBasicScope("bs", name); if (basicScope == null) { if (!needCreate) { return(null); } lock (scope.SyncRoot) { basicScope = scope.GetBasicScope("bs", name); if (basicScope == null) { basicScope = new BroadcastScope(scope, name); scope.AddChildScope(basicScope); } } } if (basicScope is IBroadcastScope) { return(basicScope as IBroadcastScope); } return(null); }
public IMessageInput GetLiveProviderInput(IScope scope, string name, bool needCreate) { IBasicScope basicScope = scope.GetBasicScope(Constants.BroadcastScopeType, name); if (basicScope == null) { if (needCreate) { lock (scope.SyncRoot) { // Re-check if another thread already created the scope basicScope = scope.GetBasicScope(Constants.BroadcastScopeType, name); if (basicScope == null) { basicScope = new BroadcastScope(scope, name); scope.AddChildScope(basicScope); } } } else { return(null); } } if (!(basicScope is IBroadcastScope)) { return(null); } return(basicScope as IBroadcastScope); }
public bool RegisterBroadcastStream(IScope scope, string name, IBroadcastStream broadcastStream) { bool flag = false; lock (scope.SyncRoot) { IBasicScope basicScope = scope.GetBasicScope("bs", name); if (basicScope == null) { basicScope = new BroadcastScope(scope, name); scope.AddChildScope(basicScope); } if (basicScope is IBroadcastScope) { (basicScope as IBroadcastScope).Subscribe(broadcastStream.Provider, null); flag = true; } } return(flag); }
public IMessageInput GetLiveProviderInput(IScope scope, string name, bool needCreate) { IBasicScope basicScope = scope.GetBasicScope(Constants.BroadcastScopeType, name); if (basicScope == null) { if (needCreate) { lock(scope.SyncRoot) { // Re-check if another thread already created the scope basicScope = scope.GetBasicScope(Constants.BroadcastScopeType, name); if (basicScope == null) { basicScope = new BroadcastScope(scope, name); scope.AddChildScope(basicScope); } } } else return null; } if (!(basicScope is IBroadcastScope)) return null; return basicScope as IBroadcastScope; }
public bool RegisterBroadcastStream(IScope scope, string name, IBroadcastStream broadcastStream) { bool status = false; lock(scope.SyncRoot) { IBasicScope basicScope = scope.GetBasicScope(Constants.BroadcastScopeType, name); if (basicScope == null) { basicScope = new BroadcastScope(scope, name); scope.AddChildScope(basicScope); } if (basicScope is IBroadcastScope) { (basicScope as IBroadcastScope).Subscribe(broadcastStream.Provider, null); status = true; } } return status; }