最近用DWR开发一个AJAX生产上应用的程序,刚开始使用时WEB页面CALL JAVA代码可以正常返回信息,而且速度很快,但是使用一段时间后返回信息的时间变慢,甚至有时会出现没有返回信息的状态。
不知各位有没有遇到相关问题,是如何解决的?请赐教,谢谢!
不知各位有没有遇到相关问题,是如何解决的?请赐教,谢谢!
解决方案 »
- sql语句不知道列名能查数据吗?
- MyEclipse 7.0里面能写javascript吗!为什么我写了运行得不到任何效果?是不是和Macromedia Dreamweaver 8一样的写法??
- JavaBean连接MySQL的一个怪异问题
- 急,关于JSP提交表单数据到MSSQL中!
- js+css导航条问题
- 关于在jsp中读取oracle中图片的问题
- tomcat运行的问题
- struts的问题?谢谢援助。
- 取日期的后两位??
- 如何用connection pool
- DREAMWEAVER中如何建立与SQL SERVER2000的JDBC-ODBC连接
- jsp中带格式的文本怎样存入access的备注数据类型啊?
DWR 15:24:54,269 emoting.extend.TypeHintContext DEBUG Using type info from <signature> moveLocation(0<0>) of class java.lang.String
DWR 15:24:54,269 emoting.extend.TypeHintContext DEBUG Using type info from <signature> moveLocation(0<1>) of class java.lang.String
DWR 15:24:54,269 ebremoting.impl.DefaultRemoter INFO Exec: hostservice.moveLocation()
DWR 15:24:54,269 ebremoting.impl.DefaultRemoter DEBUG --Object found in application. id=0
parse reply start .......[S0LOCATION_REP HDR=(S2MOD.HT.TRACKING,MOD.WEB20090728032454.24) REPLYSTATUS=FAIL ERRORCODE=16 ERRORMSG="reasonCode = 100: PRE-CHECK CODE := 100 ERROR := boxidP592950426 is not active ! ; ruleReply = CANCELRULE"]
parse reply end .......[]
03632299 reply to client!
DWR 15:24:54,577 ting.util.DebuggingPrintWriter DEBUG out(4980): //#DWR-INSERT
DWR 15:24:54,577 ting.util.DebuggingPrintWriter DEBUG out(4980): //#DWR-REPLY
DWR 15:24:54,577 ting.util.DebuggingPrintWriter DEBUG out(4980): dwr.engine._remoteHandleCallback('4','0',{ERRORCODE:"16",REPLYSTATUS:"FAIL",ERRORMSG:"\"reasonCode= 100: PRE-CHECK CODE := 100 ERROR := boxidP592950426 is not active ! ; ruleReply = CANCELRULE\""});
这个不是问题,经过我的N次测试,既使出现了这样的问题,我可以将DATA SOURCE可连接数设置很大很大,
我提供LOG的那一段调用不是DB部份,是我们APP SERVER部分,从APP SERVER也正常返回给WEB SERVER,但是从WEB SERVER返回给CLIENT端出现了问题,出现了问题之后将WEB SERVER重启之后用一段时间之后又出现同样的问题/
如果每次REQUEST时都关闭或打开DB连接,那次次数太频繁,会造成新的性能问题,REQUEST结束并意味着过几分在没有REQEST了。
http://www.java1995.org/ JAVA学习网站
if (loginUser==""){
alert("你还没登录,请登录!")
return;
}
if (document.form1.txtlocation.value==""){
alert("请输入LOCATION!");
document.form1.txtlocation.focus();
return;
}
if (document.getElementById("labMaxqty").innerHTML==""){
alert("LOCATION信息有问题,输入LOCATION后请按回车!");
document.form1.txtlocation.focus();
return;
}
if (document.form1.txtpallet.value==""){
alert("请输入LOCATION!");
document.form1.txtpallet.focus();
return;
}
if (document.getElementById("labproduct").innerHTML==""){
alert("PALLETID信息有问题,输入LOCATION后请按回车!");
document.form1.txtpallet.focus();
return;
} var v_orderNo="";
if (document.all.trOrder.style.display=="block"){
if (document.all.orderReqQty.innerHTML==""){
alert(document.all.txtOrder.value+"的OUT信息没有得到,输入ORDERNO请按回车!");
document.all.txtOrder.focus();
return;
} v_orderNo= document.all.txtOrder.value;
}
var request={
LOTSET:document.form1.txtpallet.value,
LOCATIONID:document.form1.txtlocation.value,
ACTIVITY:"MOVE",
ORDERNO:v_orderNo
}; //alert(request.ORDERNO);
//hostservice.moveLocation(request,callpass);
hostservice.moveLocation(request,
{callback:function(str) {callBackSubmit(str); },
timeout:30000,
errorHandler:function(message) { alert( message); }
}); //LoginHtml(document.form1.txtUserid.value,document.form1.txtPasswd.value,floorValue);
}function callBackSubmit(data){
if (data.REPLYSTATUS=="FAIL") {
alert("失败["+data.ERRORMSG+"]");
}else{
alert(data.REPLYSTATUS);
}
fromClear();
}
HashMap replyMap=new HashMap();
User user=(User)sess.getAttribute("USER");
if (user==null){
replyMap.put("REPLYSTATUS", "FAIL");
replyMap.put("ERRORMSG", "你没有登录,请登录!");
return replyMap;
}
map.put("USERID", user.getUserId());
TibMessageSendReply tib=new TibMessageSendReply(user,"S0LOCATION");
try{
tib.sendMessage(map);
}catch(Exception e){
replyMap.put("REPLYSTATUS", "FAIL");
replyMap.put("ERRORMSG", e.getMessage());
tib=null;
return replyMap;
}
replyMap=(HashMap)tib.getReply();
//tib=null;
System.out.println(user.getUserId()+" reply to client!");
return replyMap;
}
package pda.common;import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import java.util.Set;import com.tibco.tibrv.Tibrv;
import com.tibco.tibrv.TibrvException;
import com.tibco.tibrv.TibrvListener;
import com.tibco.tibrv.TibrvMsg;
import com.tibco.tibrv.TibrvMsgCallback;
import com.tibco.tibrv.TibrvRvdTransport;
import com.tibco.tibrv.TibrvTransport;public class TibMessageSendReply {
private String service = null;
private String network = null;
private String daemon = null;
private String subJect = null;
private String replySubject=null;
private String cmd=null;
private String FIELD_NAME = "DATA";
private String sendSubect ="HT.TRACKING";
private boolean runing=false;
private Map replyResult;
public Map getReply(){
return replyResult;
}
public TibMessageSendReply(String service,String network,String daemon,String subject,String cmd){
this.service=service;
this.network=network;
this.daemon=daemon;
this.subJect=subject;
this.cmd=cmd;
replyResult=new HashMap();
}
public TibMessageSendReply(User user,String cmd){
this.service=user.getTibService();
this.network=user.getTibNetwork();
this.daemon=user.getTibDaemon();
this.subJect=user.getTibSubject();
this.cmd=cmd;
replyResult=new HashMap();
}
private String paseMessage(Map message){
Random random = new Random();
replySubject="MOD.WEB"+
(new java.text.SimpleDateFormat("yyyyMMddhhmmss")).format(new Date())+
"."+random.nextInt(100);
String sMessage="HDR=("+this.subJect+"."+this.sendSubect+","+replySubject+")";
Set entries=message.entrySet();
Iterator iter=entries.iterator();
while(iter.hasNext()){
Map.Entry entry=(Map.Entry)iter.next();
String key=(String)entry.getKey();
String value=(String)entry.getValue();
sMessage=sMessage+" "+key+"="+value;
}
return sMessage;
}
public void sendMessage(Map message) throws Exception{
try{
Tibrv.open(Tibrv.IMPL_NATIVE);
}catch (TibrvException e) {
System.err.println("Failed to open Tibrv in native implementation:");
throw new Exception("Failed to open Tibrv in native implementation:");
}
TibrvTransport transport = null;
try {
transport = new TibrvRvdTransport(this.service,this.network,this.daemon);
} catch (TibrvException e) {
System.err.println("Failed to create TibrvRvdTransport:");
throw new Exception("Failed to create TibrvRvdTransport:");
}
TibrvMsg msg = new TibrvMsg();
try{
msg.setSendSubject(this.subJect+"."+sendSubect);
} catch (TibrvException e) {
System.err.println("Failed to set send subject:");
throw new Exception("Failed to set send subject:");
}
String sMessage=cmd+" "+paseMessage(message);
runing=true;
//Tibrvlisten tibListen=new Tibrvlisten();
try{
System.out.println("Publishing: subject="+msg.getSendSubject()+
" \""+sMessage+"\"");
msg.update(FIELD_NAME,sMessage);
transport.send(msg);
}catch (TibrvException e){
System.err.println("Error sending a message:");
throw new Exception("Error sending a message:");
}
Tibrvlisten tibListen=new Tibrvlisten();
while(runing); // Close Tibrv, it will cleanup all underlying memory, destroy
// transport and guarantee delivery.
try
{
Tibrv.close();
}
catch(TibrvException e)
{
System.err.println("Exception dispatching default queue:");
throw new Exception("Exception dispatching default queue:");
}
}
private class Tibrvlisten implements TibrvMsgCallback{
public Tibrvlisten() throws Exception{
try{
Tibrv.open(Tibrv.IMPL_NATIVE);
} catch (TibrvException e){
System.err.println("Failed to open Tibrv in native implementation:");
throw new Exception("tiblistne open[Failed to open Tibrv in native implementation:]");
}
TibrvTransport transport = null;
try{
System.out.println("service="+service+",network="+network+",daemon="+daemon);
transport = new TibrvRvdTransport(service,network,daemon);
} catch (TibrvException e){
System.err.println("Failed to create TibrvRvdTransport:");
throw new Exception("tiblistne open[Failed to create TibrvRvdTransport:]");
}
try{
new TibrvListener(Tibrv.defaultQueue(),
this,transport,subJect+"."+replySubject,null);
System.err.println("Listening on: "+subJect+"."+replySubject);
} catch (TibrvException e){
System.err.println("Failed to create listener:");
throw new Exception("tiblistne open[Failed to create listener:]");
}
int sleepCont=0;
while(runing)
{
try
{
Tibrv.defaultQueue().dispatch();
}
catch(TibrvException e)
{
System.err.println("Exception dispatching default queue:");
throw new Exception("tiblistne open[Exception dispatching default queue:]");
}
catch(InterruptedException ie)
{
throw new Exception("tiblistne open["+ie.getMessage()+"]");
}
}
try{
Tibrv.close();
} catch(TibrvException e) {
System.err.println("Exception dispatching default queue:");
throw new Exception("Exception dispatching default queue:");
}
}
public void onMsg(TibrvListener arg0, TibrvMsg msg) {
// TODO Auto-generated method stub
replyResult.clear();
/*
System.out.println((new Date()).toString()+
": subject="+msg.getSendSubject()+
", reply="+msg.getReplySubject()+
", message="+msg.toString()
);
System.out.flush();*/
String repStr=msg.toString();
repStr=repStr.substring(repStr.indexOf(FIELD_NAME)+6, repStr.length()-4).trim();
System.out.println(repStr);
//repStr=repStr.replace("\"", "");
while(repStr.length()>0){
int pos=repStr.indexOf(32);
String key;
if (pos==-1){
key=repStr;
repStr="";
}else {
key=repStr.substring(0, pos);
int pos1=key.indexOf("\"");
if (pos1!=-1){
String tmpStr=repStr.substring(pos+1);
pos1=tmpStr.indexOf("\"");
key=key+tmpStr.substring(0,pos1+1);
repStr=tmpStr.substring(pos1+1);
}
else {
repStr=repStr.substring(pos+1);
}
repStr=repStr.trim();
}
if (key.indexOf("=")!=-1){
String tmpKey=key.substring(0,key.indexOf("=")); if (tmpKey.equals("HDR")) continue;
String tmpValue=key.substring(key.indexOf("=")+1);
replyResult.put(tmpKey, tmpValue);
} else {
continue;
}
// System.out.println(key);
}
runing=false;
}
}
public static void main(String[] args){
TibMessageSendReply msgSend=new TibMessageSendReply("7521",";239.109.120.1","7521","S1MOD","PDA");
HashMap map=new HashMap();
map.put("USER", "ZLL");
map.put("LOTID", "ZLL");
try{
msgSend.sendMessage(map);
map=(HashMap)msgSend.getReply();
Set entries=map.entrySet();
Iterator iter=entries.iterator();
while(iter.hasNext()){
Map.Entry entry=(Map.Entry)iter.next();
String key=(String)entry.getKey();
String value=(String)entry.getValue();
System.out.println("key="+key+",value="+value);
}
}catch(Exception e){
e.printStackTrace();
}
}
}