1、Object... 作为参数 多态
2、Map预加载
Map<Integer,StatisType> types = Collections.synchronizedMap(new HashMap<Integer,StatisType>());
启动服务器时调用以下方法
public void contextInitialized(ServletContextEvent sce){
ServletContext application = sce.getServletContext();
Map systemUsers = Collections.synchronizedMap(new HashMap());
application.setAttribute("systemUsers", systemUsers);
}
java动态代理生成一个线程安全的实现了MAP接口的对象,因为zaiapplication里面,是个全局变量,保证了多线程访问数据的一致性,在调用方法时加了同步关键字。
3、代码上划一横线
deprecated函数和变量,不推荐使用。