public int RegisterSubscription(WoopsaContainer root, bool isServerSide, string woopsaPropertyPath, TimeSpan monitorInterval, TimeSpan publishInterval) { BaseWoopsaSubscriptionServiceSubscription newSubscription; int subscriptionId; _watchClientActivity.Restart(); lock (_idLock) { _lastSubscriptionId++; subscriptionId = _lastSubscriptionId; } if (isServerSide) { WoopsaBaseClientObject subclient; string relativePath; if (FindWoopsaClientAlongPath(root, woopsaPropertyPath, out subclient, out relativePath)) { // subscribe directly instead of polling newSubscription = new WoopsaSubscriptionServiceSubscriptionServerSubClient( this, root, subscriptionId, woopsaPropertyPath, monitorInterval, publishInterval, subclient, relativePath); } else { newSubscription = new WoopsaSubscriptionServiceSubscriptionMonitorServer( this, root, subscriptionId, woopsaPropertyPath, monitorInterval, publishInterval); } } else { newSubscription = new WoopsaSubscriptionServiceSubscriptionMonitorClient( this, (WoopsaBaseClientObject)root, subscriptionId, woopsaPropertyPath, monitorInterval, publishInterval); } lock (_subscriptions) _subscriptions.Add(newSubscription.SubscriptionId, newSubscription); return(newSubscription.SubscriptionId); }
public int RegisterSubscription(WoopsaContainer root, bool isServerSide, string woopsaPropertyPath, TimeSpan monitorInterval, TimeSpan publishInterval) { BaseWoopsaSubscriptionServiceSubscription newSubscription; int subscriptionId; _watchClientActivity.Restart(); lock (_idLock) { _lastSubscriptionId++; subscriptionId = _lastSubscriptionId; } if (isServerSide) { WoopsaBaseClientObject subclient; string relativePath; if (FindWoopsaClientAlongPath(root, woopsaPropertyPath, out subclient, out relativePath)) // subscribe directly instead of polling newSubscription = new WoopsaSubscriptionServiceSubscriptionServerSubClient( this, root, subscriptionId, woopsaPropertyPath, monitorInterval, publishInterval, subclient, relativePath); else newSubscription = new WoopsaSubscriptionServiceSubscriptionMonitorServer( this, root, subscriptionId, woopsaPropertyPath, monitorInterval, publishInterval); } else newSubscription = new WoopsaSubscriptionServiceSubscriptionMonitorClient( this, (WoopsaBaseClientObject)root, subscriptionId, woopsaPropertyPath, monitorInterval, publishInterval); lock (_subscriptions) _subscriptions.Add(newSubscription.SubscriptionId, newSubscription); return newSubscription.SubscriptionId; }