📄 downloadmanager2.java
字号:
package de.uni_bremen.informatik.p2p.plugins.filesharing.network.download.server;
import java.io.IOException;
import java.util.ArrayList;
import net.jxta.protocol.PipeAdvertisement;
import org.apache.log4j.Logger;
import de.uni_bremen.informatik.p2p.peeranha42.core.network.NetworkException;
import de.uni_bremen.informatik.p2p.peeranha42.core.network.connection.BiDiServer;
import de.uni_bremen.informatik.p2p.plugins.filesharing.data.FilesharingState;
/**
* @author Lars Kordes
*/
public class DownloadManager2 extends Thread {
private ArrayList shares;
private BiDiServer bidisrv;
/** Logger for warnings, debugs and fatals */
protected static Logger log = Logger.getLogger(DownloadManager2.class);
public DownloadManager2(ArrayList shares, PipeAdvertisement arg1) throws NetworkException {
this.shares = shares;
bidisrv = new BiDiServer(FilesharingState.peergroup , arg1, 0);
if(bidisrv == null) throw new NetworkException("Could not start download service.");
try {
FilesharingState.peergroup.getDiscoveryService().publish(arg1);
} catch (IOException e) {
throw new NetworkException("Could not publish Advertisement: "+e.toString());
}
FilesharingState.peergroup.getDiscoveryService().remotePublish(arg1);
}
public void run() {
while(true) {
try {
DownloadServer con = new DownloadServer(bidisrv.accept(), shares);
}
catch(NetworkException e) { log.error("\n___" + e); }
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -