bbsclient.java
来自「精通Jboss——Ejb和Web Services开发精解的随书源代码」· Java 代码 · 共 45 行
JAVA
45 行
/**
* Client.java Created on 2003-12-8
*
*/
package com.liuyang.ejb.cmp.bbs.client;
/**
* @author liuyang
*
*/
public class BBSClient {
public static void main(String[] args) throws Exception {
/*Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL,"localhost");
Context iniCtx = new InitialContext(env);
Object objRef = iniCtx.lookup("cmp/BBS");
BBSHome home = (BBSHome)PortableRemoteObject.narrow(objRef, BBSHome.class);
Collection col = home.findALLOrderByTime();
if((col!=null)&&(!col.isEmpty())){
Iterator it = col.iterator();
while(it.hasNext()){
BBS bbs = (BBS) (it.next());
System.out.println("time = "+bbs.getTime()+" text = "+bbs.getText());
}
}else{
for(int i=0;i<100;i++){
boolean v = false;
while(!v){
long t1 = System.currentTimeMillis();
Collection bss = home.findByTime(new Long(t1));
if((bss!=null)&&(!bss.isEmpty())){
System.out.println("wait for "+t1);
}else{
home.create(new Long(System.currentTimeMillis()),"hello");
v = true;
}
}
}
}*/
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?