proxychains无法加载进程?

时间:2016-04-29 03:08:30

标签: javascript c node.js

  

我使用brew install proxychains-ng并编辑 proxychains.conf 文件   并将socks4 127.0.0.1 9080更改为 socks5 127.0.0.1 1080   打开shadowsocks

然后运行zsh [proxychains] config file found: /usr/local/Cellar/proxychains- ng/4.11/etc/proxychains.conf [proxychains] preloading /usr/local/Cellar/proxychains-ng/4.11/lib/libproxychains4.dylib proxychains can't load process....: No such file or directory

控制台:

/**
 * DPServer.java
 * <p>
 * This class implements the methods called by the philosophers
 */
package cc;

import java.util.Random;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class DPServer {

    private static Lock chopstick[] = new Lock[5]; // Create chopstick locks
    private static Lock mutex = new ReentrantLock(true);

    private static int MAX_EAT_TIME = 5000; // maximum eating time in milliseconds
    private static int MAX_THINK_TIME = 5000; // maximum thinking time in milliseconds
    private static Random r = new Random(0);


    // default constructor for DPServer class
    public DPServer() {
        for (int i = 0; i < 5; i++) {
            chopstick[i] = new ReentrantLock(true);
        } // end for

    } // end DPServer default constructor


    // called by a philosopher when they wish to eat
    public void takeChopsticks(int philosopherNumber) {
        // acquire chopstick[philosopherNumber] and chopstick[(philosopherNumber + 1) mod 5]
        System.out.println("Acquiring chopstick[" + philosopherNumber + "] and chopstick[" + ((philosopherNumber + 1) % 5) + "]");
        chopstick[philosopherNumber].lock();
        chopstick[(philosopherNumber + 1) % 5].lock();
        // eat for a random number of milliseconds
        int eatTime = r.nextInt(MAX_EAT_TIME);
        System.out.println("Philosopher " + philosopherNumber + " is eating for " + eatTime + " milliseconds");
        try {
            Thread.sleep(eatTime);
        } catch (InterruptedException ex) {
            System.out.println("Philosopher " + philosopherNumber + " eatTime sleep was interrupted");
        }

    } // end takeChopsticks


    // called by a philosopher when they are finished eating
    public void returnChopsticks(int philosopherNumber) {
        // release chopstick[philosopherNumber] and chopstick[(philosopherNumber + 1) mod 5]
        System.out.println("Releasing chopstick[" + philosopherNumber + "] and chopstick[" + ((philosopherNumber + 1) % 5) + "]");
        chopstick[(philosopherNumber + 1) % 5].unlock();
        chopstick[philosopherNumber].unlock();

        // think for a random number of milliseconds
        int thinkTime = r.nextInt(MAX_THINK_TIME);
        System.out.println("Philosopher " + philosopherNumber + " is thinking for " + thinkTime + " milliseconds");
        try {
            Thread.sleep(thinkTime);
        } catch (InterruptedException ex) {
            System.out.println("Philosopher " + philosopherNumber + " thinkTime sleep was interrupted");
        }
    }
}


// implementation of the Dining Philosopher class
package cc;

public class DPhilosopher {
    private int dpNum;
    private DPServer dpServ;

    // value constructor for the DPhilosopher class
    public DPhilosopher(int num, DPServer d) {
        dpNum = num;
        dpServ = d;
    } // end DPhilosopher value constructor


    public void DPEatThink() {
        while (true) {
            // get ready to eat
            System.out.println("Philosopher " + dpNum + " is getting ready to eat");
            dpServ.takeChopsticks(dpNum);

            // finish eating
            System.out.println("Philosopher " + dpNum + " is finished eating");
            dpServ.returnChopsticks(dpNum);

        }

    }

    public static void main(String[] args) {
        DPServer dps = new DPServer();
        DPhilosopher dp[] = new DPhilosopher[5];
        Thread dpThread[] = new Thread[5];

        // Create and launch the DPhilosopher threads
        for (int i = 0; i < 5; i++) {
            dp[i] = new DPhilosopher(i, dps);
            final int finalI = i;
            dpThread[i] = new Thread(new Runnable() {
                @Override
                public void run() {
                    dp[finalI].DPEatThink();
                }
            });
            dpThread[i].start();
        }

    } // end main
}

1 个答案:

答案 0 :(得分:0)

如果您有https代理,例如,请使用polipo的端口8123代理socks5的端口1080

你可以像下面这样做

https_proxy=https://127.0.0.1:8123 nvm ls-remote