Skip to content

Fix serialization fo quartz JobExecutionContext - #5263

Merged
trask merged 2 commits into
open-telemetry:mainfrom
laurit:quartz-serializable
Jan 28, 2022
Merged

Fix serialization fo quartz JobExecutionContext#5263
trask merged 2 commits into
open-telemetry:mainfrom
laurit:quartz-serializable

Conversation

@laurit

@laurit laurit commented Jan 28, 2022

Copy link
Copy Markdown
Contributor

Resolves #5243

@laurit
laurit requested a review from a team January 28, 2022 10:57
Comment on lines +18 to +21
private static final VirtualField<JobExecutionContext, Context> contextVirtualField =
VirtualField.find(JobExecutionContext.class, Context.class);
private static final VirtualField<JobExecutionContext, Scope> scopeVirtualField =
VirtualField.find(JobExecutionContext.class, Scope.class);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about making a ContextAndScope class and using just one virtual field?

Comment on lines +125 to +127
// ensure that JobExecutionContext is serializable
try {
new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(context);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@trask
trask merged commit 72afa5a into open-telemetry:main Jan 28, 2022
@laurit
laurit deleted the quartz-serializable branch January 29, 2022 10:32
RashmiRam pushed a commit to RashmiRam/opentelemetry-auto-instr-java that referenced this pull request May 23, 2022
* Fix serialization fo quartz JobExecutionContext

* address review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Context and Span are not Serializable and are injected into Quartz Job Data which is Serializable

3 participants