I'm currently working on implementing a privacy preserving data mining algorithm. For the communication part between the different parties I'm using Netty 4.0. The communication flow between the parties looks like this:
-- multiplicationMsg --> ... -- multiplicationMsg -->
P_{1} P_{N}
<-- multiplicationMsg -- ... <-- multiplicationMsg --
where P_{1}
is the master party that initiates and controls the whole computation. The logic for the secure multi-party multiplication is located in Netty ChannelHandler
s. There is also another protocol for secure addition.
At the moment I use a similar solution like this, shown by Norman Maurer from Netty core team, to get informed if a sub-protocol computation has finished. But that feels a bit like fighting against the framework.
Is there a way to get a custom promise from channel.write(msg)
, that will be created and fulfilled in the ChannelPipeline
? In my example above, it should be fulfilled when multiplicationMsg
arrives back at P_{1}
.
Edit 1
This is what I normally do to write a message from outside of the ChannelPipeline
:
ChannelFuture f = channel.write(msg);
future.addListener(new ChannelFutureListener() {
public void operationComplete(ChannelFuture future) {
//do something with the future
}
});
The ChannelFuture
f
from the example above will be fulfilled, if the data could be written to the socket or if a failure occurs. But I need a way do get back a custom Future
in addition to the ChannelFuture
, somehow like:
ChannelFuture f = channel.write(msg);
future.addListener(new ChannelFutureListener() {
public void operationComplete(ChannelFuture future) {
// I need something like the following
if(future.isSuccess()) {
Future myFuture = future.getMyFuture();
}
}
});