I read a post on the Microsoft CCR forum on reducing the overhead of calling Port.Post () calls [ref .: Building a PortElement in CCR ], and I was wondering if there is a similar way to bind a port to its receiver in order to use the port in OptimizedSingleReissueReceiver mode in the arsenal of alternation?
I implemented the following code that uses this PortMode for Interleave:
Receiver receiver = Arbiter.Receive(true, inputPort, inputPortHandler);
inputPort.Mode = PortMode.OptimizedSingleReissueReceiver;
ExclusiveReceiverGroup exclusiveReceiverGroup = new ExclusiveReceiverGroup(receiver);
Interleave interleave = Arbiter.Interleave(new TeardownReceiverGroup(),
exclusiveReceiverGroup,
new ConcurrentReceiverGroup());
Arbiter.Activate(dispatcherQueue, interleave);
At first it looked fine, however from time to time I still get a NullReferenceException (this exception indicates that the port is not yet connected to the receiver).
Does anyone know a different way to use PortMode.OptimizedSingleReissueReceiver inside Interleave?