📄 clientinput.java~61~
字号:
package Services;
import java.io.*;
import java.net.*;
import Utilities.*;
import Config;
/**
* <p>Title: InHand SMS platform XMLRouter</p>
* <p>Description: InHand 短信服务平台服务路由器</p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: 北京映翰通网络技术有限公司</p>
* @author 韩传俊 shock2000@21cn.com
* @version 1.0
*/
public class ClientInput extends Engine {
ServiceInfo serviceInfo=null;
DataInputStream in=null;
public ClientInput(ServiceInfo serviceInfo,InputStream in) {
super("module"+serviceInfo.id+".clientinput");
this.serviceInfo=serviceInfo;
this.in=new DataInputStream(in);
}
public void run(){
String inStr="";
long now=System.currentTimeMillis();
while(isRunning()){
try{
if (this.serviceInfo.is_connect){
if ((inStr=in.readLine())!=null){
Config.log.log("Client module["+this.serviceInfo.id+"]","read",inStr);
//if (inStr.startsWith("<cmpp_submit")){
while(!Config.send_queue.push(inStr));
if (inStr.startsWith("<cmpp_submit"))
this.serviceInfo.incMt();
this.serviceInfo.incInputNumber();
//}//else{
// Config.send_queue.push(inStr);
// }
now=System.currentTimeMillis();
}else{
if (System.currentTimeMillis()-now>10000){
this.shutIt();
Config.log.log("module["+this.serviceInfo.id+"]: input for a long period.shutdown this Thread !");
//this.serviceInfo.clientOutput.shutdown();
//this.serviceInfo.is_connect=false;
}
}
}else{
this.shutIt();
}
}catch(Exception e){
//e.printStackTrace();
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!");
this.shutIt();
//this.serviceInfo.is_connect=false;
//this.serviceInfo.clientInput=null;
//this.serviceInfo.clientOutput.shutdown();
//this.serviceInfo.clientOutput=null;
}
}
//shutdown();
}
public void shutIt(){
try{
this.in.close();
shutdown();
this.serviceInfo.clientOutput.shutdown();
Config.log.log("clent module["+serviceInfo.id+"].input shutdown ...");
}catch(Exception e){
Config.log.log(e,"while clent module["+serviceInfo.id+"].input shutdown ...");
}
}
public static void main(String[] args) {
// ClientInput clientInput1 = new ClientInput();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -