开发者

What do you call a situation where the pooled database connection is not used immediately?

While running through a piece of code for performance tuning, i noticed that the开发者_运维问答 pooled database connection is not used immediately, it follows some pre-processing before the connection used to delegate a SQL update call.

I fixed the codes by delaying the retrieval of the pooled database connection until before the codes is ready to call on the insert method.

As i am trying to update the documentation that this optimization is done, how should i work it in a sentence or title?

Old Codes:

... 

connection = ConnectionFactory.getPooledConnection(); // get pooled connection

String message = StringUtils.replace(log, "a", "b");

// many other processing

connection.update(message);

connection.release();
...

New Codes:

... 


String message = StringUtils.replace(log, "a", "b");

// many other processing

connection = ConnectionFactory.getPooledConnection(); // get pooled connection

connection.update(message);

connection.release();
...


Not sure this case actually warrants it - because you've made the code behave more like it "should". But generally, such deferral of work until the moment it is needed is referred to as "lazy initialization".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜