Is java connector thread-safe? I think it isn't

BaseConnector uses two global variables (global_http_request and global_http_response) to pass the active req and response to parse_request method. Because of this construction, program would fail when two http reqs arrives nearly at the same time. So I must declare doGet method in my servlet (which extends ConnectorServlet) as synchronized, to avoid a problem. But I afraid it would help if the servlet container runs two instances of servlet.

Default implementation , which is described in the docs is not thread-safe.
But if you change configuration a bit - it can be used as thread-safe

Default config

[code]public class BasicConnector extends ConnectorServlet {

/* (non-Javadoc)
 * @see com.dhtmlx.connector.ConnectorServlet#configure()
 */
@Override
protected void configure() {
	Connection conn=null;
	try {
		Class.forName ("com.mysql.jdbc.Driver").newInstance ();
		conn = DriverManager.getConnection("jdbc:mysql://localhost/sampleDB", "root", "");
	} catch (Throwable e) {
		e.printStackTrace();
	}
	
	GridConnector c = new GridConnector(conn);
	c.dynamic_loading(100);
	c.render_table("grid50000", "item_id", "item_nm,item_cd");
}

}[/code]

Thread safe config

[code]public class BasicConnector extends ConnectorServlet {

@Override
public void doGet(HttpServletRequest req, HttpServletResponse res)
		throws ServletException, IOException {
	configure(req, res);
}

@Override
public void doPost(HttpServletRequest req, HttpServletResponse res)
		throws ServletException, IOException {
	configure(req, res);
}

/* (non-Javadoc)
 * @see com.dhtmlx.connector.ConnectorServlet#configure()
 */
protected void configure(HttpServletRequest req, HttpServletResponse res) {
	Connection conn=null;
	try {
		Class.forName ("com.mysql.jdbc.Driver").newInstance ();
		conn = DriverManager.getConnection("jdbc:mysql://localhost/sampleDB", "root", "");
	} catch (Throwable e) {
		e.printStackTrace();
	}
	
	GridConnector c = new GridConnector(conn);
	c.servlet(req, res);
	c.dynamic_loading(100);
	c.render_table("grid50000", "item_id", "item_nm,item_cd");
}

@Override
protected void configure() {
}

}[/code]

What is changed

a) get and post call new implementation of configure method
b) after connector creation servlet method is called, which sets request and response object

In such case there will not be any global data used, and code must be thread-safe.