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

📄 getthread.java

📁 短信网关发送接受平台。
💻 JAVA
字号:
package orderapp;/** * Title: * Description:接受线程,与router直连 * Copyright:    Copyright (c) 2002 * Company: * @author * @version 1.0 */import utilities.Engine;import java.io.*;import xml.*;public class getThread extends Engine {	public getLabel label;	public getThread(InputStreamReader in) {		super("getThread");		setDaemon(true);		Config.br=new BufferedReader(in);		label=new getLabel();	}	public void run(){		String xmlStr="";		String xmlTemp="";		while(isRunning()){			try{						xmlStr=Config.br.readLine();						//数据分流						//1、Mo池 2、收条池 3、Response池 4、Gateway_status池						if (xmlStr!=null){							if(xmlStr.startsWith("<cmpp_deliver") ){							       xmlTemp=label.getString("cmpp_deliver/registered_delivery",xmlStr);							      if(xmlTemp.equals("1")){								//收条池								while(!Config.receipt_queue.push(xmlStr))nap();							      }else if(xmlTemp.equals("0")){								 //Mo池								 while(!Config.mo_queue.push(xmlStr))nap();								 Config.incMo();								 Config.LogPool.push("Get A MO\t"+"GatewayName:  "+label.getString("source/name",xmlStr)+";Source_Guid:  "+label.getString("source/guid",xmlStr)+";src_terminal_id"+label.getString("src_terminal_id",xmlStr)+";SubCode:  "+label.getString("destination_id",xmlStr)+";Msg_id:  "+toLowerCaseString(label.getString("msg_content",xmlStr),15));							      }							}						//Response池							if(xmlStr.startsWith("<cmpp_submit_response")){								while(!Config.response_queue.push(xmlStr))nap();								Config.resp++;								 //System.out.println(xmlStr);							}							//Gateway_status池							if(xmlStr.startsWith("<gateway_status>"))								while(!Config.gateway_queue.push(xmlStr))nap();						}else{							nap();						}						Thread.sleep(100);			}catch(Exception e){				//Config.log.log(e,"while read xmlstr from the XMLCenter in RecvManager");				e.printStackTrace();				shutdown();			}		}		try{			Config.br.close();		}catch(Exception e){			//e.printStackTrace();			shutdown();			Config.log.log(e,"while the thread: "+this.toString()+" is reading data from socket!" );			System.out.println("while the thread: "+this.toString()+" is reading data from socket!");		}	}	public void shutdown(){		super.shutdown();		try{			Config.br.close();		}catch(Exception e){}	}	public static String toLowerCaseString(String hexStr,int msg_fmt){		String result="";		String temp;		int len=hexStr.length();		if (hexStr.startsWith("00")){			len=len/4;			for (int i=0;i<len;i++){				temp=hexStr.substring(i*4+2,i*4+4);				if (Integer.parseInt(temp,16) > 0x7a)					return result;				result+=(char)Byte.parseByte(temp,16);			}		}else{			len=len/2;			for (int i=0;i<len;i++){				temp=hexStr.substring(i*2,i*2+2);				if (Integer.parseInt(temp,16) > 0x7a)					return result;				result+=(char)Byte.parseByte(temp,16);			}		}		return result.toLowerCase();	}}

⌨️ 快捷键说明

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