public boolean update(BaseVo baseVo) { Oraspaceconfig vo = (Oraspaceconfig) baseVo; boolean result = false; StringBuffer sql = new StringBuffer(); sql.append("update system_oraspaceconf set ipaddress='"); sql.append(vo.getIpaddress()); sql.append("',spacename='"); sql.append(vo.getSpacename()); sql.append("',linkuse='"); sql.append(vo.getLinkuse()); sql.append("',sms="); sql.append(vo.getSms()); sql.append(",bak='"); sql.append(vo.getBak()); sql.append("',reportflag="); sql.append(vo.getReportflag()); sql.append(",alarmvalue="); sql.append(vo.getAlarmvalue()); sql.append(" where id="); sql.append(vo.getId()); try { conn.executeUpdate(sql.toString()); result = true; } catch (Exception e) { result = false; SysLogger.error("OraspaceconfigDao:update()", e); } finally { conn.close(); } return result; }
public void run() { try { HostNodeDao nodeDao = new HostNodeDao(); // 得到被监视的防火墙设备 List nodeList = nodeDao.loadNetwork(8); for (int i = 0; i < nodeList.size(); i++) { HostNode node = (HostNode) nodeList.get(i); } Vector vector = null; int numTasks = nodeList.size(); int numThreads = 200; try { List numList = new ArrayList(); TaskXml taskxml = new TaskXml(); numList = taskxml.ListXml(); for (int i = 0; i < numList.size(); i++) { Task task = new Task(); BeanUtils.copyProperties(task, numList.get(i)); if (task.getTaskname().equals("netthreadnum")) { numThreads = task.getPolltime().intValue(); } } } catch (Exception e) { e.printStackTrace(); } // 生成线程池 ThreadPool threadPool = null; if (nodeList != null && nodeList.size() > 0) { threadPool = new ThreadPool(nodeList.size()); // 运行任务 for (int i = 0; i < nodeList.size(); i++) { threadPool.runTask(createTask((HostNode) nodeList.get(i))); } // 关闭线程池并等待所有任务完成 threadPool.join(); threadPool.close(); } threadPool = null; } catch (Exception e) { e.printStackTrace(); } finally { SysLogger.info("********Firewall Thread Count : " + Thread.activeCount()); } }