读书人

openfire(四)数据库浅析之序列

发布时间: 2013-03-21 10:08:17 作者: rapoo

openfire(4)数据库浅析之序列
??????????????????? "thread contention. Trying again...");
??????????? // Call this method again, but sleep briefly to try to avoid thread contention.
??????????? try {
??????????????? Thread.sleep(75);
??????????? }
??????????? catch (InterruptedException ie) {
??????????????? // Ignore.
??????????? }
??????????? getNextBlock(count - 1);
??????? }
??? }

此方法为:更具类型到数据库中ofid查询ID,获取表中的id,然后id加一个变量,然后将新的id更新到数据库中。

?

private void createNewID(Connection con, int type) throws SQLException {
??????? Log.warn("Autocreating jiveID row for type '" + type + "'");

??????? // create new ID row
??????? PreparedStatement pstmt = null;

??????? try {
??????????? pstmt = con.prepareStatement(CREATE_ID);
??????????? pstmt.setInt(1, type);
??????????? pstmt.execute();
??????? }
??????? finally {
??????????? DbConnectionManager.closeStatement(pstmt);
??????? }
??? }

在表中创建一条序列的记录。

?

此篇文章就到此,稍后会有更多关于openfire的个人解读。

联系方式(qq):851392159

出处:http://buerkai.iteye.com

?

读书人网 >其他数据库

热点推荐