//request for Connection came in ClientServerConnection csc = new ClientServerConnection(this, "and everything you need, at least client IP for connecting the socket"); csc.run(); //running in its own thread, of cause ClientServerConnection should extend Thread connectionList.add(csc); //a list of the connections the Server holds
@Override protected Py4JServerConnection createConnection(Gateway gateway, Socket socket) throws IOException { ClientServerConnection connection = new ClientServerConnection(gateway, socket, getCustomCommands(), (Py4JPythonClientPerThread) getCallbackClient(), this, getReadTimeout(), authToken); connection.startServerConnection(); return connection; } }
@Override protected Py4JClientConnection getConnection() throws IOException { ClientServerConnection connection = null; connection = getPerThreadConnection(); if (connection != null) { try { lock.lock(); connections.remove(connection); } finally { lock.unlock(); } } if (connection == null || connection.getSocket() == null) { Socket socket = startClientSocket(); connection = new ClientServerConnection(gateway, socket, customCommands, this, javaServer, readTimeout, authToken); connection.setInitiatedFromClient(true); connection.start(); setPerThreadConnection(connection); } return connection; }