254 points · by atomashpolskiy · 9y ago · 87 comments
I also have a simple shell script locally, that wraps the java command, so I have to just type `btmagnet AF0D9AA01A9AE123A73802CFA58CCAF355EB19F8` to download to a pre-determined location (hardcoded in the script). I wonder if I should share it on the CLI README page
Or don't use the Oracle proprietary distribution but the OpenJDK of your operating system which normally doesn't exclude proper crypto algorithms.
(be aware that the JDKs downgrade silently if certain libraries are missing in your host)
Benchmarks (like in libtorrent) is something I'm looking forward to, but the project is still in the early stage -- there's a lot to be done with regards to optimization, i.e. switching to using NIO selectors, adding a caching layer, etc. That's a lot of work, and that's why I'm looking for collaborators, before investing more time into performance-tuning.
Will look forward to reading through the code later!
I definitely like the idea. My question was more aimed to understand if Java has some desirable features for writing a torrent client maybe as part of the SDK or other 3rd party libs. I didn't even look at your source code yet :P
Java stood out to me because I don't think I've seen other CLIs written in Java.
But then you need to provide different app packages for different OSes.
I guess nothing to do with this but was triggered by two combined words: Torrent and Java
On my context it is useful for downloading large files without depending on a single point of failure or fixed location.
Have a question in regards to the example syntax:
client.startAsync(state -> { if (state.getPiecesRemaining() == 0) { client.stop(); } }, 1000).join();
This is a feature from newer Java syntax that I'm not yet familiar enough with lambdas to understand in full what is happening.
Perhaps I can ask for an example that replaces the "->" into the older Java syntax? I know this would likely come at the cost of a few extra lines, it would certainly ease a lot for many developers looking at the example. Many thanks.
client.startAsync(new Consumer<TorrentSessionState> {
void accept(TorrentSessionState state) {
if (state.getPiecesRemaining() == 0) {
client.stop();
}
}
}, 1000).join();I can only thank those who wrote such obfuscated code in previous years, that eventually forced everyone else afterwards to write code as simple and clear as reasonably possible. That's the reason why I've asked for the simplified code, Might as well save the time for other developers on similar situation.
Of course you can choose to shoot yourself in the foot and just stick with Java 6, but don't try to force others to make the same mistake.