- 浏览: 15496 次
- 性别:
- 来自: 杭州
-
最新评论
文章列表
stringBuffer与StringBuilder都extends AbstractStringBuilder一个线程安全一个不是。内部用char数组,初始大小seq lenth+16, 以*2扩容。ArrayList默认初始10,以1.5扩容。hashmap初始16,以*2扩容。内部使用Entry数组。Collections.synchronizedXXX: 得到同步的集合。新集合对像将原对像进行了封装在很多方法中加了synchronized. concurrentHashMap:高性能的同步的hashMap可用来取代hashtable,使用锁分离采用ReentrantLock,不用sy ...
ibatis有四个transaction: external, jdbc, jta, userdifined. 都implements transaction接口。
jdbcTransaction很简单,通过jdbc的connections来简单包装一下commit, rollback等。
JTA也类似,主要区别是jta通过lookup得到一个userTransaction用来进行实际的commit rollback操作,而connection只用来设transactionLevel, autoCommit等。
ExternalTransaction的commit, rollback是空实现。 ...
t.interrupt(): 中断线程t.
synchronized(o){o.wait()}: 自已放弃CPU等待o.notify().
synchronized(o){o.notify()}: 通知o.wait()的线程你可以运行了。如果这样的线程有多个,则选一个。notifyAll()将通知所有的。
注意以上都在synchronized内,因为wait, notify都必须自己的线程是the own the o's monitor,就是说必须在synchronized(o)内。
以上只能等待一个条件,若要多个条件可用lock.newCondition。
threadPool主要有fi ...
这里有深入的讲解: http://www.packtpub.com/article/starting-up-tomcat-6-1
win下的tomcat6,从startup.bat入口,调用catalina.bat设置环境变量,调用setenv.bat, setclasspath.bat,然后调java,入口org.apache.catalina.startup.Bootstrap,classpath只有bootstrap.jar包。
bootstrap.jar初始化JVM的系统变量,初始化classLoaders,调用catalina.start()启动第一个service.
clas ...
--get:
sessionImpl调用IdentifierLoadAccessImpl.load(id);在这个方法中,sessionFactoryImpl.getEntityPersister从entityPersisters map取entity的mapping信息,放到LoadEvent, 然后sessionImpl.fireLoad(event);
fireLoad从listeners列表找到onload的listener并调用其onload.
这个listener是DefaultLoadEventListener。参数event和loadType. get将调用load--> ...
以前看不懂童话。公主等待着她的王子,王子为了他的公主做出很多疯狂的事。
直到现在还是看不懂。只是偶尔,居然会为一个陌生人而伤心。没有爱的我,孤独终老。
连接池:
hibernate自带连接池但不推荐在prod中使用。常用可选有c3p0, proxool, dbcp等.也可通过jndi查找。
二级缓存:
hibernate默认没有启用二级缓存,有一个内置的二级缓存可用:HashtableCacheProvider但不推荐在prod中使用。常用的选项有ehcache, oscache, swarmcache, jbosscache等。
reference: http://mestachs.wordpress.com/tag/hibernate/
ibatis拥抱sql,在其sqlmapping中有各种sql的定义,定义中有#,$等占位符。那么ibatis是在哪里处理这些语句的呢?
每条定义(statement)对应一个MappedStatement, 来看MappedStatement的源代码。以queryForList为例:
在sqlMapExecutorDelegation中调用
ms.executeQueryForList(statementScope,xxx)得到结果list。
MappedStatement中executeQueryWithCallback(StatementScope,xxx)。其中有
sqlExecu ...
一直用ibus、但它默认用左shift换中英文,今天终于找到全修改的方法,强:
http://yoursaf.blog.163.com/blog/static/5542652720128265352411/
cd /usr/share/ibus-table/engine/
sudo vim table.py
搜索 “Match mode switch hotkey”
# Match mode switch hotkey
if not self._editor._t_chars and ( self._match_hotkey (key, keysyms.Shift_L, modifier.SH ...
字符串中的字符数量可以用String.length()得到,查看jdk源代码可以看到
/**
* Returns the length of this string.
* The length is equal to the number of <a href="Character.html#unicode">Unicode
* code units</a> in the string.
*
* @return the length of the sequence of characters ...