JEP415: FilterInThread Example

Dr Heinz M. Kabutz heinz at javaspecialists.eu
Mon Feb 6 09:35:38 UTC 2023


Hi Roger,

thanks for your quick response. That does seem to work better.

Regards

Heinz
-- 
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java™ Specialists' Newsletter" -www.javaspecialists.eu
Java Champion -www.javachampions.org
JavaOne Rock Star Speaker
Tel: +30 69 75 595 262
Skype: kabutz

On 2023/02/06 06:55, Roger Riggs wrote:
> *// Returns a composite filter of the static JVM-wide filter, a 
> thread-specific filter, *// and the stream-specific filter. *public 
> ObjectInputFilter apply(ObjectInputFilter curr, ObjectInputFilter 
> next) { *if (curr == null) { *// Called from the OIS constructor or 
> perhaps OIS.setObjectInputFilter with no current filter *var filter = 
> filterThreadLocal.get(); *if (filter != null) { *// Merge to invoke 
> the thread local filter and then the JVM-wide filter (if any) *filter 
> = ObjectInputFilter.merge(filter, next); *return 
> ObjectInputFilter.rejectUndecidedClass(filter); *} *return (next == 
> null) ? null : ObjectInputFilter.rejectUndecidedClass(next); *} else { 
> *// Called from OIS.setObjectInputFilter with a current filter and a 
> stream-specific filter. *// The curr filter already incorporates the 
> thread filter and static JVM-wide filter *// and rejection of 
> undecided classes *// If there is a stream-specific filter merge to 
> invoke it and then the current filter. *if (next != null) { *return 
> ObjectInputFilter.merge(next, curr); *} *return curr; *} *}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20230206/36f56bb5/attachment.htm>


More information about the core-libs-dev mailing list