志敏's profile新的开始,新的生活PhotosBlogListsMore ![]() | Help |
|
10/30/2006 超郁闷的旅途这个周末回上海,来回都让我郁闷得要命 先是回上海的时候做了杭州东站的车,结果碰到一辆超超慢的车,居然开了三个半小时,搞得我半夜12点才到家。 回来的时候就更倒霉了。本应该坐三号线到上海南站的,结果不小心坐了四号线(真不知道三号线和四号线怎么设计的,居然有十来站是重叠的),只能往回坐,换一号线到了南站,得知已经没车了。哎~那个汗。没办法,只能转战长途汽车南站,还好就在附近。车票贵点也只能忍了,舒舒服服两个小时到了杭州,发现杭州汽车东站已经没有公交车到玉泉了,于是孤零零地一个人走到杭州火车东站,幸好28路是通宵营业的,不然...... 到寝室已经11点半了,洗漱一下,明天还要早起去实验室 10/28/2006 Hibernate的Thread Local Session昨天同学问我关于Hibernate Thread Local Session的问题,一下子居然答不上来了,记得以前学习的时候还是仔细看过的。回寝室之后,赶紧查了资料,以下是源代码 public class HibernateSession { public static final ThreadLocal session = new ThreadLocal(); public static Session currentSession() throws NamingException, HibernateException { Session s = (Session) session.get(); if (s == null) { SessionFactory sf = (SessionFactory) new InitialContext() .lookup("SessionFactory"); s = sf.openSession(); session.set(s); } return s; } public static void closeSession() throws HibernateException { Session s = (Session) session.get(); session.set(null); if (s != null) s.close(); } } 其实,要掌握Thread Local Session,必须要理解java的ThreadLocal类,它的作用是为每一个使用该变量的线程都提供一个变量值的副本,使每一个线程都可以独立的改变自己的副本,而不会和其它线程的副本发生冲突。下面做个实验: public class TestThreadLocal { private static ThreadLocal tl = new ThreadLocal(); public static String get() { return tl.get().toString(); } public static void main(String[] args) { TestThreadLocal test = new TestThreadLocal(); TestThread1 test1 = test.new TestThread1(); TestThread2 test2 = test.new TestThread2(); test1.start(); test2.start(); } class TestThread1 extends Thread { public void run() { tl.set(new Object()); System.out .println(TestThreadLocal .get()); } } class TestThread2 extends Thread { public void run() { System.out .println(TestThreadLocal .get()); } } } 其返回的结果是 java.lang.Object@923e30 Exception in thread "Thread-1" java.lang.NullPointerException at TestThreadLocal.get(TestThreadLocal.java:6) at TestThreadLocal$TestThread2.run(TestThreadLocal.java:30) 对于TestThread1和TestThread2它们都获得了变量的副本(初始为null),在TestThread1中设置变量指为一个Object,但是并没有影响TestThread2中变量的副本,这就是ThreadLocal提供的能力。 再来说Hibernate Thread Local Session, 一,对于同一个线程的访问调用获得的是同一个HibernateSession。如果是OpenSessionInView的话,那么对于一个用户Request,应用的就是同一个HibernateSession。 二,对于不同的线程的访问调用获得的是不用的HibernateSession。 10/20/2006 重操旧业自从由Windows换到Ubuntu下,再也没有玩过游戏,记得上一次还是暑假时和刘、杨、朱一起打三国无双的RPG。 开学之后,发现寝室的其他三个人好像都不玩游戏,自己也就没什么兴致了。想当年314,cs、魔兽、实况无一不精,那是多么有氛围啊。不过,情况从昨天晚上开始有所变化,隔壁寝室的人带着我上校网2v2,结果1负1胜,也算是研究生的复出之战了。 还有就是,我现在的ubuntu已经配好了3D桌面下(Xgl+compiz),那真是太炫了 10/12/2006 Certification Lab Exam resultsDear Huang Zhimin: The results of your RHCE Certification Exam are reported below. The RHCE Certification Exam allows candidates to qualify for the Red Hat Certified Engineer (RHCE) and Red Hat Certified Technician (RHCT) certificates. Please note that the RHCE designation is understood to both include and supersede the RHCT designation. SECTION I: TROUBLESHOOTING AND SYSTEM MAINTENANCE RHCE requirements: completion of compulsory items (50 points) overall section score of 80 or higher RHCT requirements: completion of compulsory items (50 points) Compulsory Section I score: 50.0 Non-compulsory Section I score: 50.0 Overall Section I score: 100 SECTION II: INSTALLATION AND CONFIGURATION RHCE requirements: score of 70 or higher on RHCT components (100 points) score of 70 or higher on RHCE components (100 points) RHCT requirement: score of 70 or higher on RHCT components (100 points) RHCT components score: 90.9 RHCE components score: 100.0 RHCE Certification: PASS Congratulations -- you are now certified as a Red Hat Certified Engineer! Your RHCE Certificate number is 804006253022649. The attached file is your personal print-ready certificate. If your name does not appear correctly please go to https://www.redhat.com/training/certification/comments.html, and send us a note including your certificate number and your name typed as it should appear and we will send you a modified version of the certificate. You are entitled to print this document and use it to demonstrate that you are an RHCE, provided you remain an RHCE in good standing. You may not modify or change the document's contents in any way, nor may you appropriate any elements of this document for use in other electronic documents or printed materials. You may only print the document in its entirety. Any other use of the document must be approved by Red Hat, Inc. Your RHCE number should be available for verification at Red Hat Certification Central: http://www.redhat.com/training/certification/verify/?rhce_cert_display:certno=804006253022649&rhce_cert_display:verify_cb=Verify You can verify the certificates of other RHCEs and RHCTs at https://www.redhat.com/training/certification/verify Please visit RHCE Connection, our web site exclusively for RHCEs: https://www.redhat.com/training/certification/ There you will find special offers from Red Hat, logo art, job listings, and more. You can also use the site to manage your contact information. In order to access the site, you will need a PIN number. You can have the PIN sent to the email address we have on file at https://www.redhat.com/training/certification/lostpin.html Certification in Red Hat Enterprise Linux opens up new opportunities. We hope you will keep Red Hat updated with your experiences and successes with Red Hat Enterprise Linux. Please feel free to contact us with ideas and suggestions as to ways we can enhance our Red Hat Enterprise Linux training and certification programs at https://www.redhat.com/training/certification/comments.html Thank you very much for your interest in Red Hat Enterprise Linux! Red Hat Certification Central 10/5/2006 重回交大今天大一的班级聚会,在闵行交大,正好重回交大看看。 还是一样的大兴土木,阔别3个月之后,发现多了个F楼,还有一个某某人冠名的楼。N多个楼或正在动工,或即将竣工。电院群楼旁边造了个钟楼,走进一看原来是新的行政楼,主楼旁边还有一座很欧式的建筑,被我们形象地形容为神学院和修道院。 只可惜正在放假,没什么人,也没有校园巴士,只得匆匆一览,然后去了同学的宿舍。交大的研究生宿舍就是好啊,想想自己住的,终于明白了什么叫做“住在交大”了。2人一间,有阳台,有吊扇,有独立卫生间,有热水澡洗,居然还有地方自己烧东西吃,太羡慕了! 研究生宿舍旁边就是4食堂,完完全全是拷贝当年在我们楼下的3食堂,也是食堂,教育超市,理发店,连布局都是一模一样。 鸟巢体育馆已见雏形了,也许等我下次来的时候就能进去转转了。 |
|
|