You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3f8dd6c
Browse filesBrowse the repository at this point in the historyBrowse files
* ref(core): Remove deprecated Hub APIs
Remove the Hub compatibility layer and migration aliases now that IScopes and Scopes are the supported APIs.
Refs GH-3069
Co-Authored-By: Claude <noreply@anthropic.com>
* changelog
---------
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .cursor/rules/scopes.mdc
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,8 @@ Data itself is stored on `Scope` instances.
14
14
## `Hub`
15
15
16
16
Up until major version 7 of the Java SDK the `IHub` interface was a central part of the SDK.
17
-
In major version 8 we replaced the `IHub` interface with `IScopes`. `IHub` has been deprecated.
18
-
While there is some bridging code in place to allow for easier migration, we are planning to remove it in an upcoming major.
17
+
In major version 8 we replaced the `IHub` interface with `IScopes` and deprecated the Hub compatibility APIs.
18
+
Those compatibility APIs were removed in major version 9.
19
19
20
20
## Scope Types
21
21
@@ -79,7 +79,7 @@ There were several implementations of the `IHub` interface:
79
79
`HubAdapter` has been replaced by `ScopesAdapter`
80
80
`Hub.clone` should be replaced by using `pushScope` or `pushIsolationScope`
81
81
`Sentry.getCurrentHub` has been replaced by `Sentry.getCurrentScopes`
82
-
`Sentry.popScope` has been deprecated. Instead `close` should be called on the `ISentryLifecycleToken` returned e.g. by `pushScope`. This can also be done in a `try-with-resource` block.
82
+
`Sentry.popScope` was deprecated in version 8 and removed in version 9. Instead, `close` should be called on the `ISentryLifecycleToken` returned e.g. by `pushScope`. This can also be done in a `try-with-resources` block.
83
83
84
84
## `globalHubMode`
85
85
The SDK has a `globalHubMode` option which affects forking behaviour of the SDK.
@@ -93,8 +93,8 @@ For JVM Backend applications (servers) we discourage enabling `globalHubMode` si
93
93
If `globalHubMode` is enabled, the SDK avoids forking scopes _implicitly_.
94
94
95
95
This means, retrieving current scopes on a thread where specific scopes do not exist yet for the thread, the root scopes are not forked but returned directly.
96
-
`Sentry.pushScope`, `Sentry.pushIsolationScope` and `Sentry.popScope` are no-ops.
97
-
They are unbalanced API: the caller may never restore the previous scopes, or restore them on a different thread, which would corrupt the globally shared scopes.
96
+
`Sentry.pushScope`and `Sentry.pushIsolationScope` are no-ops and return no-op lifecycle tokens.
97
+
Implicit forking is suppressed because callers could otherwise fail to restore the previous scopes, or restore them on a different thread, which would corrupt the globally shared scopes.
98
98
99
99
`Sentry.withScope` and `Sentry.withIsolationScope` do fork, also when `globalHubMode` is enabled.
100
100
They are balanced by construction and always restore the previous scopes before returning, so they cannot corrupt the shared scopes.
Copy file name to clipboardExpand all lines: sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,8 @@ class MainActivity : ComponentActivity() {
36
36
37
37
super.onCreate(savedInstanceState)
38
38
val outboxPath =
39
-
Sentry.getCurrentHub().options.outboxPath ?:throwRuntimeException("Outbox path is not set.")
39
+
Sentry.getCurrentScopes().options.outboxPath
40
+
?:throwRuntimeException("Outbox path is not set.")
0 commit comments