当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: In the first article of this ser
 

 

    摘要:when we think about educational institutions, one of most traditional ways of measuring understanding is the use of questions, organized in assignments and tests. teachers around the world share the c......
    摘要:the 5.0 release of jdk introduced a slew of new features. a powerful technique that resulted from the jsr-175 recommendation is the program annotation facility. it can annotate code in a standard way ......


Berkeley DB, Java Edition II: Implementing Session Management

in the first article of this series, we went through the basics of using berkeley db. in this article, were going to walk through a more extended example of using it. the example im going to use is session management. while this series of examples doesnt illustrate the full power of berkeley db, it will give you a good feel for how to use it. and you might be surprised at how complicated some aspects of using berkeley db are.

there is a global map from session keys to instances of session. persistence of the global map to disk: if the system shuts down and restarts, it should still have the sessions from before the shutdown. old sessions are expired. usually, this happens if the sessions havent been used in a while. simple session management 【程序编程相关:Building the Ultimat

conceptually, session management is very simple. there are three basic requirements: 【推荐阅读:Java 5.0 - Tiger: A

create a binding for session (e.g., write implementations of entrytoobject() and objecttoentry()). define where the database will be stored on disk. create a session manager class, sleepycatbasedsessionmanager, which the rest of the application will use. internally, it will manage interactions with berkeley db. as part of sleepycatbasedsessionmanager, this will include a background thread for synchronizing with the disk.

weve already talked about sessionbinding. there are, however, two important points that id like to emphasize. the first is that the binding has to be reversible--entrytoobject(objecttoentry(session)) will create a second instance of session. but it should be equivalent to the first session (all of the fields should have the same value). similarly, objecttoentry(entrytoobject(databaseentry)) should yield an equivalent instance of databaseentry. 【扩展信息:QueryParser Rules

suppose we only wanted to implement the first two requirements: a global map from session keys to instances of session and persistence of the global map to disk. the code for this is pretty simple, and youve already seen most of it. assuming there is already have a class named session, we need to do the following:


...   下一页
 ·scratch    »显示摘要«
    摘要:all of the hype around j2me these days seems to center around game development on cell phones. while this is certainly an exciting application space, it is important to remember that not all graphical......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE