I am using py4j to communicate from Java to Python. I packed the Java code below into a Jar and I am running in with the command java -jar file.jar BUT looking into it I can see this command runs about 30 times in separate threads although I called it once. I suspect it happens because the way py4j is implemented. How can I set a maximum on the number of threads py4j uses? what communication between Java and python can I use that will be lower on memory?
public static void main(String[] args) {
final GroupTerms groupTerms = new GroupTerms();
new GatewayServer(groupTerms).start();
}