当前位置: 代码迷 >> Web前端 >> webservice以及线程运用
  详细解决方案

webservice以及线程运用

热度:34   发布时间:2012-11-04 10:42:41.0
webservice以及线程应用
new Thread()
            {
                public void run()
                {
                    Client client=null;
                     try{  
                        URL url = new URL(urlStr);
                        URLConnection connection = url.openConnection();
                        connection.setConnectTimeout(timeOut);
                        connection.setReadTimeout(timeOut);
                        connection.connect();
                        client = new Client(connection.getInputStream(),null);
                        client.setProperty(CommonsHttpMessageSender.DISABLE_KEEP_ALIVE, "true");
                        client.setProperty(CommonsHttpMessageSender.HTTP_TIMEOUT,
                                String.valueOf(timeOut));
                        //远程调用
                        client.invoke(GET_DATA_METHOD, new Object[]
                        { monTypeThread, id, tableName,
                                tailThreeWSParams[0], tailThreeWSParams[1],
                                tailThreeWSParams[2] });
                        logger.debug("Real Time Traffic : [ObjectType: "
                                + monTypeThread + "]" + ",[ObjectId : "
                                + id + "],[TableName : " + tableName + "]");
                   
                     }           
            }.start();
  相关解决方案