當試圖從swing應用程序連接到glassfish v3時,它第一次非常慢。需要4-10秒。 在客戶端:
首先連接到Glassfish v3的速度很慢
public void myMethod(){
NewSessionBeanRemote facade;
try {
InitialContext ic = new InitialContext();
facade = (NewSessionBeanRemote) ic.lookup(NewSessionBeanRemote.class.getName());
target.setText(facade.businessMethod());
} catch (NamingException ex) {
ex.printStackTrace();
}
}
在服務器端:
@Stateless
public class NewSessionBean implements NewSessionBeanRemote {
@Override
public String businessMethod() {
return String.valueOf(Math.random() + 121 + 300);
}
}
@Remote
public interface NewSessionBeanRemote {
String businessMethod();
}
我需要什麼環境中的變化?
我之前沒有帶使用Glassfish的,但可能這僅僅是標準的Java虛擬機器冷啓動? – Syntax 2010-09-14 08:57:47
服務器正在運行。所有其他時間我都會立即獲得數據。 – Dmitry 2010-09-14 09:02:34