我在Ubuntu 16.04上运行nginx / passenger,它工作正常,但由于某种原因,package com.demo.json;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.nio.charset.Charset;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.simple.JSONArray;
public class ReadJSON {
private static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
return sb.toString();
}
public static JSONObject readJsonFromUrl(String url) throws IOException, JSONException {
InputStream is = new URL(url).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
JSONObject json = new JSONObject(jsonText);
return json;
} finally {
is.close();
}
}
public static void main(String[] args) throws IOException, JSONException {
JSONObject json = readJsonFromUrl("http://10.11.123.12:8001/json/testing/agency.json");
JSONArray agenciesArray = (JSONArray) json.get("agency");
for (int i=0; i<agenciesArray.size(); i++) {
agenciesArray.get(i);
}
}
}
对于cpu和内存都显示为零。如果我使用passenger-status
运行它没有任何区别。有没有其他人见过这个?