[
http://issues.apache.org/jira/browse/DIRMINA-185?page=comments#action_12368975
]
Trustin Lee commented on DIRMINA-185:
-------------------------------------
This issue relates to DIRMINA-169 very closely.
If we remove IoFilter.init() and destroy(), then how can users wrap
ThreadPoolFilter with IoFilterWithLifeCycle class? We cannot if we don't have
any standardized names. We need to add another interface which provides
standard method names so users can wrap ThreadPoolFilter and
IoFilterWithLifeCycle call ThreadPoolFilter.init() and destroy() appropriately.
For example:
interface LifeCycleSupport { // or we could extend IoFilter
void start() throws Exception;
void stop() throws Exception;
}
public class ThreadPoolFilter implements IoFilter, LifeCycleSupport {
...
}
public class IoFilterWithLifeCycle {
public void start()
{
...
if( wrappedFilter instanceof LifeCycleSupport ) {
wrappedFilter.start();
}
...
}
}
> Refactor IoFilter life cycle management
> ---------------------------------------
>
> Key: DIRMINA-185
> URL: http://issues.apache.org/jira/browse/DIRMINA-185
> Project: Directory MINA
> Type: Improvement
> Reporter: Niklas Therning
> Priority: Minor
>
> I thought it would be good to have this discussion in JIRA. Please add your
> thoughs to this issue. Below I'll try to give a background to the problem.
> Recently, a discussion on IoFilter life cycle management has been going on on
> the MINA mailing list. Questions have been raised whether MINA should provide
> life cycle management (LCM) for all filters (the current situation), if it
> should be optional (either on by default or off by default) or if it
> shouldn't be supported at all.
> In version 0.9.2 of MINA IoFilter has six LCM methods:
> init, onPreAdd, onPostAdd, onPreRemove, onPostRemove and destroy
> The LCM is handled by AbstractIoFilterChain and the singleton
> IoFilterLifeCycleManager. IoFilterLifeCycleManager uses reference counting to
> determine whether init/destroy should be called when a filter is added
> to/removed from a filter chain.
> In MINA 0.8 filter chains were typically shared among sessions. This meant
> that init/destroy would only be called once (or at least very few times) in
> the lifetime of an application. However, in MINA 0.9 filter chains are always
> per session which means that in some circumstances init/destroy will be
> called very frequently.
> The discussion on LCM forked from the discussion on DIRMINA-169. The LCM
> described above causes a deadlock in the current implementation of
> ThreadPoolFilter.
> How do you think MINA should handle LCM?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira