Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup deprecations to develop next major version (v2) #515

Merged
merged 41 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4b79b4b
Start a new branch for next major release
sjoerdtalsma Oct 25, 2024
64e9f2a
Update readme.md
sjoerdtalsma Oct 25, 2024
58c2b91
Update readme.md
sjoerdtalsma Oct 25, 2024
8a47c52
Remove deprecated Context interface.
sjoerdtalsma Nov 2, 2024
679bc3e
Remove deprecated ContextTimer interface.
sjoerdtalsma Nov 2, 2024
4d50b09
Remove deprecated ContextSnapshot interface.
sjoerdtalsma Nov 4, 2024
18ac134
Bump minimum java version to 1.8
sjoerdtalsma Nov 4, 2024
e2033ec
Replace deprecated ContextSnapshotSupplier with Supplier<ContextSnaps…
sjoerdtalsma Nov 4, 2024
541bc35
Remove deprecated Wrapper class.
sjoerdtalsma Nov 4, 2024
d4d2757
Remove deprecated WrapperWithContext class.
sjoerdtalsma Nov 4, 2024
c637edc
Remove deprecated DelegatingFuture class.
sjoerdtalsma Nov 4, 2024
1ac5e5f
Remove deprecated DelegatingExecutorService class.
sjoerdtalsma Nov 4, 2024
79b45b5
Remove deprecated CallMappingExecutorService class.
sjoerdtalsma Nov 4, 2024
e461f0c
Migrate most of the code to the new API.
sjoerdtalsma Nov 6, 2024
2e541b8
Remove deprecated clearable package.
sjoerdtalsma Nov 6, 2024
4f77f7d
Remove deprecated priority comparator mechanism (including service ca…
sjoerdtalsma Nov 6, 2024
eb93ed3
Remove old abstract threadlocal base class.
sjoerdtalsma Nov 6, 2024
34c6d36
New module names for context-propagation-api and context-propagation-…
sjoerdtalsma Nov 6, 2024
37f254d
Remove relocated executors package.
sjoerdtalsma Nov 6, 2024
9425d34
Binning the context observer. Possibly reintroduce a ContextSnapshot …
sjoerdtalsma Nov 6, 2024
c2d96f2
Restructuring into context-propagation-api / context-propagation-core…
sjoerdtalsma Nov 7, 2024
fe24f46
Remove core dependency from locale-context module.
sjoerdtalsma Nov 7, 2024
aeb9f1c
Organization: Move all Context Timers in 'timers' group.
sjoerdtalsma Nov 7, 2024
9c44cad
Organization: Move Locale Context Manager in 'managers' group.
sjoerdtalsma Nov 7, 2024
c86124c
Organization: Move Slf4j Context Manager in 'managers' group.
sjoerdtalsma Nov 7, 2024
dd319c2
Organization: Move ServletRequest Context Manager in 'managers' group.
sjoerdtalsma Nov 7, 2024
8c06b95
Organization: Move Log4j2 Context Manager in 'managers' group.
sjoerdtalsma Nov 8, 2024
c18c9cf
Organization: Move OpenTracing Context Manager in 'managers' group.
sjoerdtalsma Nov 8, 2024
2878a2d
Organization: Move Spring Security Context Manager in 'managers' group.
sjoerdtalsma Nov 8, 2024
ce395b1
Remove obsolete test.
sjoerdtalsma Nov 8, 2024
9ee148e
Deprecate ContextManager constructors in favour of singleton provider()
sjoerdtalsma Nov 8, 2024
b93214f
Minor documentation improvements.
sjoerdtalsma Nov 8, 2024
9ede75b
Simplification of bom; remove explicit sources and javadoc classifier…
sjoerdtalsma Nov 8, 2024
1142c57
Simplify logging when no ContextManagers are found.
sjoerdtalsma Nov 8, 2024
8a18425
Simplifying ContextManagers and avoid new Lists when creating or reac…
sjoerdtalsma Nov 8, 2024
b4dcb84
Simplifying ContextManagers and avoid new Lists when creating or reac…
sjoerdtalsma Nov 8, 2024
ffc4b9b
Simplification; replace ListIterator by index for-loop.
sjoerdtalsma Nov 8, 2024
f7e3502
Clean up: remove Closeable / IOException from test that were introduc…
sjoerdtalsma Nov 8, 2024
185178c
Minor touchups.
sjoerdtalsma Nov 8, 2024
567774f
Replace several fully qualified names by simple names + import.
sjoerdtalsma Nov 8, 2024
74c436a
Extend ContextTimer api with thrown errors.
sjoerdtalsma Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
14 changes: 5 additions & 9 deletions context-propagation/pom.xml → context-propagation-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,18 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>nl.talsmasoftware.context</groupId>
<artifactId>context-propagation-root</artifactId>
<version>1.1.1-SNAPSHOT</version>
<artifactId>context-propagation</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<!-- Artifact identification -->
<artifactId>context-propagation</artifactId>
<name>Context propagation (core)</name>
<artifactId>context-propagation-api</artifactId>
<name>Context propagation (api)</name>
<packaging>jar</packaging>

<properties>
<project.moduleName>${project.groupId}</project.moduleName>
<project.moduleName>${project.groupId}.api</project.moduleName>
<root.basedir>${project.parent.basedir}</root.basedir>
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
<!-- Suppress java version deprecation warnings -->
<project.compiler.argument>-Xlint:-options</project.compiler.argument>
<project.javadoc.version>8</project.javadoc.version>

<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package nl.talsmasoftware.context.api;

import nl.talsmasoftware.context.ContextManager;

import java.io.Closeable;

/**
Expand Down Expand Up @@ -44,9 +42,9 @@
*
* @param <T> Type of the context value.
* @author Sjoerd Talsma
* @since 1.1.0
* @since 2.0.0
*/
public interface Context<T> extends Closeable, nl.talsmasoftware.context.Context<T> {
public interface Context<T> extends Closeable {

/**
* The value associated with this context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package nl.talsmasoftware.context.api;

import nl.talsmasoftware.context.clearable.Clearable;

/**
* The service definition a {@linkplain Context} manager.
*
Expand All @@ -26,8 +24,9 @@
*
* @param <T> type of the context value
* @author Sjoerd Talsma
* @since 2.0.0
*/
public interface ContextManager<T> extends nl.talsmasoftware.context.ContextManager<T>, Clearable {
public interface ContextManager<T> {

/**
* Initialize a new context containing the specified <code>value</code>.
Expand All @@ -41,20 +40,12 @@ public interface ContextManager<T> extends nl.talsmasoftware.context.ContextMana
*/
Context<T> initializeNewContext(T value);

/**
* The currently active context, or <code>null</code> if no context is active.
*
* @return The active context or <code>null</code> if there is none.
* @deprecated In favour of {@link #getActiveContextValue}
*/
@Deprecated
Context<T> getActiveContext();

/**
* The value of the currently active context, or {@code null} if no context is active.
*
* @return The value of the active context, or {@code null} if no context is active.
* @see Context#getValue()
* @since 2.0.0
*/
T getActiveContextValue();

Expand All @@ -72,6 +63,8 @@ public interface ContextManager<T> extends nl.talsmasoftware.context.ContextMana
*
* <p>
* This method normally should only get called by {@code ContextManagers.clearActiveContexts()}.
*
* @since 2.0.0
*/
void clear();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package nl.talsmasoftware.context.api;

import nl.talsmasoftware.context.Context;
import nl.talsmasoftware.context.ContextManager;

import java.io.Closeable;

/**
Expand All @@ -41,9 +38,9 @@
* {@link Reactivation#close()}.
*
* @author Sjoerd Talsma
* @since 1.1.0
* @since 2.0.0
*/
public interface ContextSnapshot extends nl.talsmasoftware.context.ContextSnapshot {
public interface ContextSnapshot {

/**
* Temporarily reactivates all captured context values that are in the snapshot.
Expand All @@ -69,8 +66,10 @@ public interface ContextSnapshot extends nl.talsmasoftware.context.ContextSnapsh
*
* <p>
* It is <strong>strongly advised</strong> to only use reactivation with try-with-resources code blocks.
*
* @since 2.0.0
*/
interface Reactivation extends Closeable, Context<Void> {
interface Reactivation extends Closeable {
/**
* Ends the contexts from the reactivated context snapshot.
*
Expand All @@ -79,15 +78,6 @@ interface Reactivation extends Closeable, Context<Void> {
* before the snapshot was activated.
*/
void close();

/**
* A reactivation contains no value.
*
* @return Always {@code null}.
* @deprecated From the next major version, Reactivation will no longer extend Context.
*/
@Deprecated
Void getValue();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,30 @@
/**
* Minimal Service Provider Interface for services that wish to get informed of context switching metrics.
* <p>
* Currently the following timed operations are updated:
* Currently, the following timed operations are updated:
* <ul>
* <li>{@code ContextManagers.createContextSnapshot}</li>
* <li>{@code ContextSnapshot.reactivate}</li>
* <li>{@code ContextManager.initializeNewContext}(*)</li>
* <li>{@code ContextManager.getActiveContext}(*)</li>
* <li>{@linkplain ContextSnapshot#reactivate()}</li>
* <li>{@linkplain ContextManager#getActiveContextValue()} (*)</li>
* <li>{@linkplain ContextManager#initializeNewContext(Object)} (*)</li>
* </ul>
* <p>
* (*) <em>Timing is updated for each concrete {@code ContextManager} implementation class</em>
*
* @author Sjoerd Talsma
* @since 1.1.0
* @since 2.0.0
*/
public interface ContextTimer {

/**
* Provides a new update for the context timer.
*
* @param type The class being called
* @param method The method being called
* @param duration The duration of the method
* @param unit The unit of the duration
* @param type Class that was called
* @param method Method that was called
* @param duration Duration of the call
* @param unit Unit of the duration
* @param error Error that was thrown in the call (optional, normally {@code null})
*/
void update(Class<?> type, String method, long duration, TimeUnit unit);
void update(Class<?> type, String method, long duration, TimeUnit unit, Throwable error);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2016-2024 Talsma ICT
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Main API concepts used throughout the {@code context-propagation} library.
*
* <h2>{@linkplain nl.talsmasoftware.context.api.Context}</h2>
* <p>
* A {@linkplain nl.talsmasoftware.context.api.Context context} contains
* a {@linkplain nl.talsmasoftware.context.api.Context#getValue() value}.<br>
* There can be one active context per thread. A context remains active until it is closed or another context
* is activated in that thread.
*
* <p>
* An {@code AbstractThreadLocalContext} base class is provided in the core module that supports
* nested contexts and provides predictable behaviour for out-of-order closing.
*
* <h2>{@linkplain nl.talsmasoftware.context.api.ContextManager}</h2>
* <p>
* Manages the active context.
* Can {@linkplain nl.talsmasoftware.context.api.ContextManager#initializeNewContext(java.lang.Object) initialize a new context}
* and provides access to
* the {@linkplain nl.talsmasoftware.context.api.ContextManager#getActiveContextValue() active context value}.
*
* <p>
* For most application code it should not be necessary to interact with context managers directly.
* Instead, using the various context-aware utility classes will automatically propagate context values.
*
* <h2>{@linkplain nl.talsmasoftware.context.api.ContextSnapshot}</h2>
* <p>
* A snapshot contains the current value from all known context managers.<br>
* These values can be reactivated in another thread.<br>
* Reactivated snapshots must be closed to avoid leaking context.
*
* <p>
* All context aware utility classes in this library are tested
* to make sure they reactivate and close snapshots in a safe way.
*
* @author Sjoerd Talsma
*/
package nl.talsmasoftware.context.api;
Loading
Loading