
If set, the JVM-wide filter factory selects the filter for each stream when the stream is constructed and when a stream-specific filter is set. The JVM-wide filter factory is a function invoked when each ObjectInputStream is constructed and when the stream-specific filter is set using. The parameters are the current filter and a requested filter and the function returns the filter to be used for the stream. When invoked from the ObjectInputStream constructors, the first parameter is null and the second parameter is the static JVM-wide filter. setObjectInputFilter(), the first parameter is the filter currently set on the stream (which was set in the constructor), and the second parameter is the filter requested.Ī typical filter factory should use or merge the static JVM-wide filter with other application and context specific filters and the stream-specific filter, if one is set on the stream. The filter factory implementation can also use any contextual information at its disposal, for example, extracted from the application thread context, or its call stack, to compose and combine a new filter.

