parent
aab8cb36c7
commit
286faa354f
|
@ -2,6 +2,7 @@ package jgsc;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
|
import java.lang.*;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
@ -37,7 +38,7 @@ public class GstoreConnector {
|
||||||
//this may help to reduce the GC cost
|
//this may help to reduce the GC cost
|
||||||
public String sendGet(String param) {
|
public String sendGet(String param) {
|
||||||
String url = "http://" + this.serverIP + ":" + this.serverPort;
|
String url = "http://" + this.serverIP + ":" + this.serverPort;
|
||||||
String result = "";
|
StringBuffer result = new StringBuffer();
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
System.out.println("parameter: "+param);
|
System.out.println("parameter: "+param);
|
||||||
|
|
||||||
|
@ -82,7 +83,7 @@ public class GstoreConnector {
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
//PERFORMANCE: this can be very costly if result is very large, because many temporary Strings are produced
|
//PERFORMANCE: this can be very costly if result is very large, because many temporary Strings are produced
|
||||||
//In this case, just print the line directly will be much faster
|
//In this case, just print the line directly will be much faster
|
||||||
result += line;
|
result.append(line);
|
||||||
//System.out.println("get data size: " + line.length());
|
//System.out.println("get data size: " + line.length());
|
||||||
//System.out.println(line);
|
//System.out.println(line);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +104,7 @@ public class GstoreConnector {
|
||||||
e2.printStackTrace();
|
e2.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//NOTICE: no need to connect now, HTTP connection is kept by default
|
//NOTICE: no need to connect now, HTTP connection is kept by default
|
||||||
|
|
Loading…
Reference in New Issue