小编Max*_*x08的帖子

使用多个线程使用JSch下载文件

我试图使用多个线程从远程服务器下载多个文件.但是,当我使用多个线程时,我得到了

java.lang.IOException:管道已关闭.

当我使用一个线程时,相同的代码工作正常.

是否无法使用JSch从同一远程服务器同时下载多个文件?

SftpTest.java

public class SftpTest {

private static List<SftpAccessor> accessorList = new ArrayList<SftpAccessor>();
private static List<Payload> files = new ArrayList<Payload>();
private static ExecutorService writerThreadPool = Executors.newFixedThreadPool(10);

public static void main(String args[]) throws JSchException, InterruptedException {
    SSH srcServer = new SSH();
    srcServer.setHostname("10.22.65.140");
    srcServer.setKey("D:\\jars\\dmwvmcol01.ec2user.pem");
    srcServer.setPort("22");
    srcServer.setUsername("ec2-user");

    SftpAccessor acc = new SftpAccessor(srcServer);
    accessorList.add(acc);

    files.addAll(acc.ls("/data/test/src", false, "*", 1));

    for (Payload file : files) {
        writerThreadPool.submit(new LocalWriterThread(file));
    }

    writerThreadPool.shutdown();
    writerThreadPool.awaitTermination(20, TimeUnit.MINUTES);
}}
Run Code Online (Sandbox Code Playgroud)

LocalWriterThread.java

public class LocalWriterThread implements Callable<String> {

private Payload payload; …
Run Code Online (Sandbox Code Playgroud)

java jsch

6
推荐指数
1
解决办法
3332
查看次数

调用未定义的函数curl_version

嗨我已经在运行php 5.6的ubuntu 14.04上安装了wordpress 4.6站点.

管理页面不可见,我可以在日志中看到以下错误: -

致命错误:在第274行的/var/www/html/files/modules/postie/postie.php中调用未定义的函数curl_version()

我该如何解决?

我已经验证我们的服务器上安装了curl和php5-curl: -

ubuntu@ip-172-39-6-147:/var/www/html$ sudo apt-get install curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
curl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 137 not upgraded.
ubuntu@ip-172-39-6-147:/var/www/html$ sudo apt-get install php5-curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php5-curl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 137 not upgraded.
Run Code Online (Sandbox Code Playgroud)

php wordpress

5
推荐指数
2
解决办法
6019
查看次数

标签 统计

java ×1

jsch ×1

php ×1

wordpress ×1