i use spark rdd to write data into mysql, the operator i use is foreachPartition, in the operator i set up connection pool and write data(using scalike jdbc's), then destory the pool, howerver it seems the connection pool cannot be found occasionally, the log said Connection pool is not yet initialized. (name:'xxx), i've no idea why it happend
the data has been insert completely finally.But the exception comfused me
I believe you have implemeted in the same way (if java used)
here insead of createNewConnection() method you just implement the singleton connection object pattern and leave with out closing.
//single ton method should be like this