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();

猜你喜欢

转载自sunxuecheng.iteye.com/blog/1178926