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

📄 client.java

📁 EJB实践的服务器是用SUN的服务器
💻 JAVA
字号:
package examples;

import java.util.*;
import javax.ejb.*;
import javax.naming.*;
import java.rmi.RemoteException;
import javax.rmi.PortableRemoteObject;

/**
 * Sample test client for our E-Commerce beans
 */
public class Client 
{
    public static void main(String args[]) 
        throws Exception 
    {
        Context ctx = new InitialContext(System.getProperties());        
        CustomerHome customerHome = 
            (CustomerHome)PortableRemoteObject.narrow(
                ctx.lookup("CustomerHome"), CustomerHome.class);
       
        Customer c = 
            customerHome.create(generatePK(), "Ed Roman", "edPass", "Austin TX");
    }
    
    /**
     * Generates a primary key
     */
    private static String generatePK() throws Exception 
    {
        String pk = new Long(System.currentTimeMillis()).toString();        
        synchronized (pk) {
            Thread.sleep(100);
        }       
        return pk;
    }
}

⌨️ 快捷键说明

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