⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 server.java

📁 主要考察的是资源池的设计和实现
💻 JAVA
字号:
import ServerImpl.ServerConfigure;
import ServerImpl.*;

import org.omg.CORBA.ORB;
import org.omg.CORBA.Policy;
import org.omg.PortableServer.*;
public class Server {
    public static void main(String[] args) {
        // java Server RoundRobin 1000
        if(args.length!=0){
           if(args.length==2)
           {
               ServerConfigure.pooling=true;
               ServerConfigure.SetPooling(args[0],Integer.parseInt(args[1]));
               System.out.println(ServerConfigure.GetStrategyType()+"  "+ServerConfigure.GetPoolSize());
           }
           else{
               System.out.println("args error\n");
           }
        }
        try{  
            ORB orb=ORB.init(args,null) ;
            POA rootPOA=POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
            Policy[] policies={
                    rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT)
            };
            POA myPOA=rootPOA.create_POA("BankPOA",rootPOA.the_POAManager(),policies);
            AccountManagerImpl servant =new AccountManagerImpl();
            myPOA.activate_object_with_id("BankManager".getBytes(),servant);
            rootPOA.the_POAManager().activate();
            System.out.println("Server launch\n");
            orb.run();
        }catch(Exception e){
            e.printStackTrace();         
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -