1126
1127
private _createSubscription(kind: StateComponents, key: string): ManagedSubscription {
1129
>
case StateComponents.Session:
1130
return new SessionStateSubscription(key, this._clientId, this._seqAllocator, this._log);
1132
return new ChatStateSubscription(key, this._clientId, this._seqAllocator, this._log);
1134
return new TerminalStateSubscription(key, this._clientId, this._log);
1136
return new ChangesetStateSubscription(key, this._clientId, this._seqAllocator, this._log);
1138
return new AnnotationsStateSubscription(key, this._clientId, this._seqAllocator, this._log);
1140
throw new Error('_createSubscription: root subscription is managed separately');
1142
assertNever(kind, `_createSubscription: unsupported StateComponents kind: ${kind}`);
1144
>
}
1145
1146
private _releaseSubscription(resource: URI, expected?: ManagedSubscriptionEntry): void {
1148
>
// A failed subscription can be evicted and replaced while old references
1149
>
// still exist; stale disposals must not release the replacement entry.
1150
>
if (!entry || (expected && entry !== expected)) {
1151
return;
1152
}