Howdy all!
In an effort to make my life easier I've patched Controller with two
AddProtocolFilter() methods and one RemoveProtocolFilter().
Code snippet below.
The addProtocolFilter():s check for the presence of a
ProtocolChainInstanceHandler and if there isn't one, creates a new
DefaultProtocolChainInstanceHandler and add the protocol filter to it.
A question: in ProtocolChain there are two add methods:
public boolean addFilter(ProtocolFilter protocolFilter);
public void addFilter(int pos, ProtocolFilter protocolFilter);
Should the second really return void, shouldn't it return boolean?
code snippet:
public boolean addProtocolFilter(ProtocolFilter protocolFilter) {
if (null == instanceHandler ) {
instanceHandler = new DefaultProtocolChainInstanceHandler();
}
return instanceHandler.poll().addFilter(protocolFilter);
}
public void addProtocolFilter(ProtocolFilter protocolFilter, int position)
{
if (null == instanceHandler) {
instanceHandler = new DefaultProtocolChainInstanceHandler();
}
instanceHandler.poll().addFilter(position, protocolFilter);
}
public boolean removeProtocolFilter(ProtocolFilter protocolFilter) {
if (instanceHandler != null) {
return instanceHandler.poll().removeFilter(protocolFilter);
}
return false;
}
cheers
Erik Svensson, SIX AB