Closed lyze closed 8 years ago
The current futures in TomP2P are based on MINA/Netty and I modified them according to my needs. That means, I did not spend a lot of time improving them and they work quite well.
One key feature, I'm missing in the java Future implementation is the possibility for adding a listener. A better alternative are those ListenableFuture (https://github.com/google/guava/wiki/ListenableFutureExplained, or https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/util/concurrent/ListenableFuture.html). However, I don't want to add the guava libarary as a dependency for just this feature. I look quickly for a standalone implemenation, but they did not convince me.
If you want to contribute this, feel free to do so.
The current futures in TomP2P are based on MINA/Netty and I modified them according to my needs. That means, I did not spend a lot of time improving them and they work quite well.
One key feature, I'm missing in the java Future implementation is the possibility for adding a listener. A better alternative are those ListenableFuture (https://github.com/google/guava/wiki/ListenableFutureExplained, or https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/util/concurrent/ListenableFuture.html). However, I don't want to add the guava libarary as a dependency for just this feature. I look quickly for a standalone implemenation, but they did not convince me.
If you want to contribute this, feel free to do so.
I believe that refactoring to ListenableFuture from Guava will help to eliminate problems with listeners being run on the wrong thread.
If you approve of potentially contributing this change, I will bring in the guava library as a dependency.
TomP2P should use
java.util.concurrent.Future
.Consider a class such as
net.tomp2p.dht.FutureGet
. A refactoring withjava.util.concurrent.Future
would have it implementFuture<DhtResult>
, whereDhtResult
would be a new interface that contains the data-related methods, likerawData()
,dataMap()
, etc.