晕。你要控制那些信息用application吧,在一个容器里它永远是唯一的

解决方案 »

  1.   

    to godson_2003(载物) :what is your idea if u have such a case?to pdw2009(捡垃圾去上网) :I do not undertand you too well. Can you talk about it in detail?what do u mean by "application" ?
    to: lydvqq(碧水情缘♀黑哥) Confused! did  you write your own connection pool by yourself?I just use the web server's .to zawx(submarine):\Good pattern. That is exactly How I did it . But is there more solution?
      

  2.   

    单例模式啊,看看设计模式书
    public class Example{
         private Example example;
        
         ......//其他属性
         
         private Example(){}     public synchronized Example getInstance(){
            if(null == example) example = new Example();
            return example;
         }
    }
      

  3.   

    楼主是想保持一些共有信息吧?比如在线人数,这个用静态变量好了(Static)