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

📄 netnoteloginmanager.java

📁 WAP PUSH后台源码,WAP PUSH后台源码
💻 JAVA
字号:
package com.sxit.wap.sncs;

/**
 * <p>Title: wap II</p>
 * <p>Description: 将机器的连接状态记录到数据库中</p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: sxit</p>
 * @author not attributable
 * @version 1.0
 */
import java.sql.*;
import java.util.Hashtable;
public class NetNoteLoginManager {
	public Hashtable hashtable = null;
    public NetNoteLoginManager() {
		hashtable = new Hashtable();
    }
	public synchronized void logByIp(String ip,boolean isConnected){
		if (isConnected ) {
			java.util.Date temp = null;
			if ((temp = (java.util.Date)hashtable.get(ip)) != null) {
			//write to datebase(ip,temp,new java.util.Date ())
			//call logToDB();
			}
		} else {
			if ( hashtable.get ( ip ) == null )
				hashtable.put ( ip, new java.util.Date () );
		}

	}
    public static void main(String[] args) {
		NetNoteLoginManager netNoteLoginManager = new NetNoteLoginManager();
    }
	private void logToDB() {
		//todo:需要在数据库中添加一个表,记录网络上的机器的连接状况
		Connection conn = com.sxit.wap.dacs.DBManager.getConnection ();
		Statement statement = null;
		if ( conn == null )
			return ;
		try {
			statement = conn.createStatement ();
			//todo:
			ResultSet result = statement.executeQuery ("insert into <> ()values(?,?,?,?)" );

		} catch ( SQLException e1 ) {
			e1.printStackTrace ();
		} finally {
			com.sxit.wap.dacs.DBManager.freeConnection ( conn, statement );
		}

	}
}

⌨️ 快捷键说明

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