项目采用的是hibernate+struts MyEclipse自动生成的HibernateSessionFactory里面的getSession方法我加上synchronized关键字,会影响速度吗?会造成死锁吗?
public static synchronized Session getSession() throws HibernateException {
        Session session = (Session) threadLocal.get(); if (session == null || !session.isOpen()) {
if (sessionFactory == null) {
rebuildSessionFactory();
}
session = (sessionFactory != null) ? sessionFactory.openSession()
: null;
threadLocal.set(session);
}
        return session;
    }