方法加同步锁,保证在同一个时间内只有一个人可以使用可以解决,具体可以参照http://www.blogjava.net/tscfengkui/archive/2010/11/10/337709.html?opt=admin 这个例子
注意同步~