??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲色成人中文字幕网站,亚洲一区二区三区国产精华液,亚洲精品亚洲人成在线播放http://www.tkk7.com/liyingcheng/archive/2008/01/08/173840.html飘雪飘雪Tue, 08 Jan 2008 15:47:00 GMThttp://www.tkk7.com/liyingcheng/archive/2008/01/08/173840.htmlhttp://www.tkk7.com/liyingcheng/comments/173840.htmlhttp://www.tkk7.com/liyingcheng/archive/2008/01/08/173840.html#Feedback1http://www.tkk7.com/liyingcheng/comments/commentRss/173840.htmlhttp://www.tkk7.com/liyingcheng/services/trackbacks/173840.html java 修改pȝ旉Ҏ

W一U方法:

需下蝲 jna.jar                           

a) 创徏 Kernel32 接口

package  time.test;

import  com.sun.jna.Native;
import  com.sun.jna.Structure;
import  com.sun.jna.win32.StdCallLibrary;

public   interface  Kernel32  extends  StdCallLibrary
{
    Kernel32 INSTANCE 
=  (Kernel32)Native.loadLibrary( " kernel32 " , Kernel32. class );
    
public  SYSTEMTIME GetSystemTime();

    
public   void  SetLocalTime(SYSTEMTIME localTime);

    
public   static   class  SYSTEMTIME  extends  Structure
    
{
    
// 必须有这么多个字D?按这个顺序定义属?/span>
 
         public   short  wYear;
        
public   short  wMonth;
             public short wDayOfWeek;
        
public   short  wDay;
        
public   short  wHour;
        
public   short  wMinute;
        
public   short  wSecond;
        
public   short  wMilliseconds;
       
    }

}

b) 修改旉

 

import  time.test.Kernel32.SYSTEMTIME;


public   class  SysTimeSettingDaoImp
{
    
protected   void  setLocalTime(String time)
    
{
      
// time旉格式?4位的字符Ԍ?20080108152130"
        Short year  =  Short.parseShort(time.substring( 0 4 ));
        Short month 
=  Short.parseShort(time.substring( 4 6 ));
        Short day 
=  Short.parseShort(time.substring( 6 8 ));
        Short hour 
=  Short.parseShort(time.substring( 8 10 ));
        Short minute 
=  Short.parseShort(time.substring( 10 12 ));
        Short second 
=  Short.parseShort(time.substring( 12 14 ));

        SYSTEMTIME ss 
=   new  SYSTEMTIME();
        ss.setWYear(year);
        ss.setWMonth(month);
        ss.setWDay(day);
        ss.setWHour(hour);
        ss.setWMinute(minute);
        ss.setWSecond(second);

        Kernel32 lib 
=  Kernel32.INSTANCE;
        lib.SetLocalTime(ss);
    }

}

W二U方?/span>

 

public   class  MyTimeClass
{
            
// timeAndDate格式?4位的字符串表CŞ式?/span>
             public   void  setLocalTime(String timeAndDate)
            
{
                            String date 
=  getDate(timeAndDate);
                            String time 
=  getTime(timeAndDate);
            
                            
//  修改pȝ日期和时?/span>
                            Runtime.getRuntime().exec( " cmd /c date  "   +  date);
                            Runtime.getRuntime().exec(
" cmd /c time  "   +  time);
            }

            
public  String getDate(String timeAndDate)
            
{
                    String year 
=  timeAndDate.substring( 0 4 );
                    String month 
=  timeAndDate.substring( 4 6 );
                    String day 
=  timeAndDate.substring( 6 8 );
                    
return  year  +   " - "   +  month  +   " - "   +  day;
            }

            
public  String getTime(String timeAndDate)
            
{
                    String hour 
=  timeAndDate.substring( 8 10 );
                    String minute 
=  timeAndDate.substring( 10 12 );
                    String second 
=  timeAndDate.substring( 12 14 );
                    
return  hour  +   " : "   +  minute  +   " : "   +  second;
            }

}

Linuxpȝ修改旉

  String os  =  System.getProperty( " os.name " ).toLowerCase(); // 获取操作pȝ名称

if (os.indexOf( " windows " !=   - 1 )
{
    cmd 
=   " cmd /c time  "   +  timeStr;
    ProcessUtil.printErr(Runtime.getRuntime().exec(cmd));
    cmd 
=   " cmd /c date  "   +  timeStr;
    ProcessUtil.printErr(Runtime.getRuntime().exec(cmd));
   }

   
else
   
{  
    cmd 
=   " date  "   +  timeStr; //timeStr旉到分Q先写时间再写日?br />    ProcessUtil.printErr(Runtime.getRuntime().exec(cmd));
   }


public class ProcessUtil {
   
    public static void printErr(Process p) {
        BufferedReader br = null;
        try {
            br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
            String line = null;
            while ((line = br.readLine()) != null) {
                System.out.println(line);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (br != null)
                    br.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
            p.destroy();
        }
    }
   
    public static void printConsole(Process p) {
        BufferedReader br = null;
        try {
            br = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line = null;
            while ((line = br.readLine()) != null) {
                System.out.println(line);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (br != null)
                    br.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
   
    public static String getErrInfo(Process p) {
        StringBuffer sb = new StringBuffer();
        BufferedReader br = null;
        try {
            br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
            String line = null;
            while ((line = br.readLine()) != null) {
                sb.append(line).append("\n");
            }
            return sb.toString();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (br != null)
                    br.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return null;
    }

}


 



飘雪 2008-01-08 23:47 发表评论
]]>
DBCP数据库连接池http://www.tkk7.com/liyingcheng/archive/2007/11/05/158321.html飘雪飘雪Mon, 05 Nov 2007 10:15:00 GMThttp://www.tkk7.com/liyingcheng/archive/2007/11/05/158321.htmlhttp://www.tkk7.com/liyingcheng/comments/158321.htmlhttp://www.tkk7.com/liyingcheng/archive/2007/11/05/158321.html#Feedback0http://www.tkk7.com/liyingcheng/comments/commentRss/158321.htmlhttp://www.tkk7.com/liyingcheng/services/trackbacks/158321.html阅读全文

飘雪 2007-11-05 18:15 发表评论
]]>
java多线E学?/title><link>http://www.tkk7.com/liyingcheng/archive/2007/10/26/156175.html</link><dc:creator>飘雪</dc:creator><author>飘雪</author><pubDate>Fri, 26 Oct 2007 08:10:00 GMT</pubDate><guid>http://www.tkk7.com/liyingcheng/archive/2007/10/26/156175.html</guid><wfw:comment>http://www.tkk7.com/liyingcheng/comments/156175.html</wfw:comment><comments>http://www.tkk7.com/liyingcheng/archive/2007/10/26/156175.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.tkk7.com/liyingcheng/comments/commentRss/156175.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/liyingcheng/services/trackbacks/156175.html</trackback:ping><description><![CDATA[一Q理解多U程 <br /><br />??多线E是q样一U机Ӟ它允许在E序中ƈ发执行多个指令流Q每个指令流都称Z个线E,彼此间互相独立?U程又称量q程Q它和进E一h有独立的执行控制Q由操作pȝ负责调度Q区别在于线E没有独立的存储I间Q而是和所属进E中的其它线E共享一个存储空_q得线E间的通信q较q程单?<br /><br />??多个U程的执行是q发的,也就是在逻辑上“同时”,而不是否是物理上的“同时”。如果系l只有一个CPUQ那么真正的“同时”是不可能的Q但是由于CPU的速度非常快,用户感觉不到其中的区别,因此我们也不用关心它Q只需要设惛_个线E是同时执行卛_?<br />多线E和传统的单U程在程序设计上最大的区别在于Q由于各个线E的控制彼此独立,使得各个U程之间的代码是乱序执行的,由此带来的线E调度,同步{问题,在以后探讨?<br /><br />  二:在Java中实现多U程 <br /><br />??我们不妨设想Qؓ了创Z个新的线E,我们需要做些什么?很显Ӟ我们必须指明q个U程所要执行的代码Q而这是在Java中实现多U程我们所需要做的一切! <br /><br />??真是奇QJava是如何做到这一点的Q通过c!作ؓ一个完全面向对象的语言QJava提供了类 java.lang.Thread 来方便多U程~程Q这个类提供了大量的Ҏ来方便我们控制自q各个U程Q我们以后的讨论都将围绕q个c进行?<br /><br />??那么如何提供l?Java 我们要线E执行的代码呢?让我们来看一?Thread cRThread cL重要的方法是 run() Q它为Thread cȝҎ start() 所调用Q提供我们的U程所要执行的代码。ؓ了指定我们自q代码Q只需要覆盖它Q?<br /><br />  Ҏ一Q?Thread c,覆盖Ҏ run()Q我们在创徏?Thread cȝ子类中重?run() ,加入U程所要执行的代码卛_。下面是一个例子: <br /><br />public class MyThread extends Thread { <br /> int count= 1, number; <br /> public MyThread(int num) { <br />  number = num; <br />  System.out.println("创徏U程 " + number); <br /> } <br /> public void run() { <br />  while(true) { <br />   System.out.println("U程 " + number + ":计数 " + count); <br />   if(++count== 6) return; <br />  } <br /> } <br /> public static void main(String args[]) { <br />  for(int i = 0; i ?5; i++) new MyThread(i+1).start(); <br /> } <br />} <br /><br />??q种Ҏ单明了,W合大家的习惯,但是Q它也有一个很大的~点Q那是如果我们的类已经从一个类l承Q如程序必ȝ承自 Applet c)Q则无法再?Thread c,q时如果我们又不惛_立一个新的类Q应该怎么办呢Q?<br /><br />??我们不妨来探索一U新的方法:我们不创?Thread cȝ子类Q而是直接使用它,那么我们只能我们的Ҏ作ؓ参数传递给 Thread cȝ实例Q有点类似回调函数。但?Java 没有指针Q我们只能传递一个包含这个方法的cȝ实例。那么如何限制这个类必须包含q一Ҏ呢?当然是用接口!Q虽然抽象类也可满Q但是需要承,而我们之所以要采用q种新方法,不就是ؓ了避免承带来的限制吗?Q?<br />Java 提供了接?java.lang.Runnable 来支持这U方法?<br /><br />  Ҏ二:实现 Runnable 接口 <br /><br />??Runnable 接口只有一个方?run()Q我们声明自qcd?Runnable 接口q提供这一ҎQ将我们的线E代码写入其中,完成了q一部分的Q务。但?Runnable 接口q没有Q何对U程的支持,我们q必d?Thread cȝ实例Q这一炚w过 Thread cȝ构造函数public Thread(Runnable target);来实现。下面是一个例子: <br /><br />public class MyThread implements Runnable { <br /> int count= 1, number; <br /> public MyThread(int num) { <br />  number = num; <br />  System.out.println("创徏U程 " + number); <br /> } <br /> public void run() { <br />  while(true) { <br />   System.out.println("U程 " + number + ":计数 " + count); <br />   if(++count== 6) return; <br />  } <br /> } <br /> public static void main(String args[]) { <br />  for(int i = 0; i ?5; i++) new Thread(new MyThread(i+1)).start(); <br /> } <br />} <br /><br />??严格地说Q创?Thread 子类的实例也是可行的Q但是必L意的是,该子cdL有覆?Thread cȝ run ҎQ否则该U程执行的将是子cȝ run ҎQ而不是我们用以实现Runnable 接口的类?run ҎQ对此大家不妨试验一下?<br /><br />  使用 Runnable 接口来实现多U程使得我们能够在一个类中包Ҏ有的代码Q有利于装Q它的缺点在于,我们只能使用一套代码,若想创徏多个U程q各个U程执行不同的代码,则仍必须额外创徏c,如果q样的话Q在大多数情况下也许q不如直接用多个cd别?Thread 来得紧凑?<br /><br />  lg所qͼ两种Ҏ各有千秋Q大家可以灵z运用?<br /><br />  下面让我们一h研究一下多U程使用中的一些问题?<br />  三:U程的四U状?<br /><br />  1. 新状态:U程已被创徏但尚未执行(start() 未被调用)?<br /><br />  2. 可执行状态:U程可以执行Q虽然不一定正在执行。CPU 旉随时可能被分配给该线E,从而得它执行?<br /><br />  3. M状态:正常情况?run() q回使得U程M。调?stop()?destroy() 亦有同样效果Q但是不被推荐,前者会产生异常Q后者是强制l止Q不会释N?<br /><br />  4. d状态:U程不会被分?CPU 旉Q无法执行?<br /><br />  四:U程的优先 <br /><br />??U程的优先代表该线E的重要E度Q当有多个线E同时处于可执行状态ƈ{待获得 CPU 旉ӞU程调度pȝҎ各个U程的优先来决定给谁分?CPU 旉Q优先高的U程有更大的Z获得 CPU 旉Q优先低的U程也不是没有机会,只是Z要小一些Ş了?<br /><br />??你可以调?Thread cȝҎ getPriority() ?setPriority()来存取线E的优先U,U程的优先界于1(MIN_PRIORITY)?0(MAX_PRIORITY)之间Q缺省是5(NORM_PRIORITY)?<br /><br />  五:U程的同?<br /><br />??׃同一q程的多个线E共享同一片存储空_在带来方便的同时Q也带来了访问冲H这个严重的问题。Java语言提供了专门机制以解决q种冲突Q有效避免了同一个数据对象被多个U程同时讉K?<br /><br />  ׃我们可以通过 private 关键字来保证数据对象只能被方法访问,所以我们只需针对Ҏ提出一套机Ӟq套机制是 synchronized 关键字,它包括两U用法:synchronized Ҏ?synchronized 块?<br /><br />  1. synchronized ҎQ通过在方法声明中加入 synchronized关键字来声明 synchronized Ҏ。如Q?<br /><br />public synchronized void accessVal(int newVal); <br /><br />  synchronized Ҏ控制对类成员变量的访问:每个cd例对应一把锁Q每?synchronized Ҏ都必获得调用该Ҏ的类实例的锁方能执行Q否则所属线E阻塞,Ҏ一旦执行,q占该锁,直到从该Ҏq回时才锁释放Q此后被d的线E方能获得该锁,重新q入可执行状态。这U机制确保了同一时刻对于每一个类实例Q其所有声明ؓ synchronized 的成员函C臛_只有一个处于可执行状态(因ؓ臛_只有一个能够获得该cd例对应的锁)Q从而有效避免了cL员变量的讉K冲突Q只要所有可能访问类成员变量的方法均被声明ؓ synchronizedQ?<br /><br />  ?Java 中,不光是类实例Q每一个类也对应一把锁Q这h们也可将cȝ静态成员函数声明ؓ synchronized Q以控制其对cȝ静态成员变量的讉K?<br /><br />  synchronized Ҏ的缺P若将一个大的方法声明ؓsynchronized 会大大影响效率Q典型地Q若线E类的方?run() 声明?synchronized Q由于在U程的整个生命期内它一直在q行Q因此将D它对本类M synchronized Ҏ的调用都永远不会成功。当然我们可以通过访问类成员变量的代码放C门的Ҏ中,其声明?synchronized Qƈ在主Ҏ中调用来解决q一问题Q但?Java 为我们提供了更好的解军_法,那就?synchronized 块?<br /><br />  2. synchronized 块:通过 synchronized关键字来声明synchronized 块。语法如下: <br /><br />synchronized(syncObject) { <br />//允许讉K控制的代?<br />} <br /><br />??synchronized 块是q样一个代码块Q其中的代码必须获得对象 syncObject Q如前所qͼ可以是类实例或类Q的锁方能执行,具体机制同前所q。由于可以针对Q意代码块Q且可Q意指定上锁的对象Q故灉|性较高。?br />  六:U程的阻? <p>??Z解决对共享存储区的访问冲H,Java 引入了同步机Ӟ现在让我们来考察多个U程对共享资源的讉KQ显然同步机制已l不够了Q因为在L时刻所要求的资源不一定已l准备好了被讉KQ反q来Q同一时刻准备好了的资源也可能不止一个。ؓ了解册U情况下的访问控刉题,Java 引入了对d机制的支持?</p><p>??d指的是暂停一个线E的执行以等待某个条件发生(如某资源qAQ,学过操作pȝ的同学对它一定已l很熟悉了。Java 提供了大量方法来支持dQ下面让我们逐一分析?</p><p>  1. sleep() ҎQsleep() 允许 指定以毫Uؓ单位的一D|间作为参敎ͼ它得线E在指定的时间内q入d状态,不能得到CPU 旉Q指定的旉一q,U程重新q入可执行状态?</p><p>  典型圎ͼsleep() 被用在等待某个资源就l的情ŞQ测试发现条件不满后,让线E阻塞一D|间后重新试Q直到条件满ؓ止?</p><p>  2. suspend() ?resume() ҎQ两个方法配套用,suspend()使得U程q入d状态,q且不会自动恢复Q必d对应的resume() 被调用,才能使得U程重新q入可执行状态。典型地Qsuspend() ?resume() 被用在等待另一个线E生的l果的情形:试发现l果q没有生后Q让U程dQ另一个线E生了l果后,调用 resume() 使其恢复?</p><p>  3. yield() ҎQyield() 使得U程攑ּ当前分得?CPU 旉Q但是不使线E阻塞,即线E仍处于可执行状态,随时可能再次分得 CPU 旉。调?yield() 的效果等价于调度E序认ؓ该线E已执行了够的旉从而{到另一个线E?</p><p>  4. wait() ?notify() ҎQ两个方法配套用,wait() 使得U程q入d状态,它有两种形式Q一U允?指定以毫Uؓ单位的一D|间作为参敎ͼ另一U没有参敎ͼ前者当对应?notify() 被调用或者超出指定时间时U程重新q入可执行状态,后者则必须对应?notify() 被调用?</p><p>??初看h它们?suspend() ?resume() ҎҎ有什么分别,但是事实上它们是截然不同的。区别的核心在于Q前面叙q的所有方法,d旉不会释放占用的锁Q如果占用了的话Q,而这一Ҏ法则相反?</p><p>  上述的核心区别导致了一pd的细节上的区别?</p><p>??首先Q前面叙q的所有方法都隶属?Thread c,但是q一对却直接隶属?Object c,也就是说Q所有对象都拥有q一Ҏ法。初看v来这十分不可思议Q但是实际上却是很自然的Q因一Ҏ法阻塞时要释攑֍用的锁,而锁是Q何对象都h的,调用L对象?wait() ҎDU程dQƈ且该对象上的锁被释放。而调?L对象的notify()Ҏ则导致因调用该对象的 wait() Ҏ而阻塞的U程中随机选择的一个解除阻塞(但要{到获得锁后才真正可执行Q?</p><p>??其次Q前面叙q的所有方法都可在M位置调用Q但是这一Ҏ法却必须?synchronized Ҏ或块中调用,理由也很单,只有在synchronized Ҏ或块中当前线E才占有锁,才有锁可以释放。同L道理Q调用这一Ҏ法的对象上的锁必Mؓ当前U程所拥有Q这h有锁可以释放。因此,q一Ҏ法调用必L|在q样?synchronized Ҏ或块中,该方法或块的上锁对象是调用q一Ҏ法的对象。若不满一条gQ则E序虽然仍能~译Q但在运行时会出现IllegalMonitorStateException 异常?</p><p>??wait() ?notify() Ҏ的上q特性决定了它们l常和synchronized Ҏ或块一起用,它们和操作pȝ的进E间通信机制作一个比较就会发现它们的怼性:synchronizedҎ或块提供了类g操作pȝ原语的功能,它们的执行不会受到多U程机制的干扎ͼ而这一Ҏ法则相当?block 和wakeup 原语Q这一Ҏ法均声明?synchronizedQ。它们的l合使得我们可以实现操作pȝ上一pd_֦的进E间通信的算法(如信号量法Q,q用于解军_U复杂的U程间通信问题?</p><p>  关于 wait() ?notify() Ҏ最后再说明两点Q?</p><p>??W一Q调?notify() ҎD解除d的线E是从因调用该对象的 wait() Ҏ而阻塞的U程中随机选取的,我们无法预料哪一个线E将会被选择Q所以编E时要特别小心,避免因这U不定性而生问题?</p><p>??W二Q除?notify()Q还有一个方?notifyAll() 也可起到cM作用Q唯一的区别在于,调用 notifyAll() Ҏ把因调用该对象?wait() Ҏ而阻塞的所有线E一ơ性全部解除阻塞。当Ӟ只有获得锁的那一个线E才能进入可执行状态?</p><p>??谈到dQ就不能不谈一谈死锁,略一分析p发现Qsuspend() Ҏ和不指定时期限?wait() Ҏ的调用都可能产生死锁。遗憄是,Java q不在语aU别上支持死锁的避免Q我们在~程中必d心地避免死锁?</p><p>??以上我们?Java 中实现线E阻塞的各种Ҏ作了一番分析,我们重点分析?wait() ?notify() ҎQ因为它们的功能最强大Q用也最灉|Q但是这也导致了它们的效率较低,较容易出错。实际用中我们应该灉|使用各种ҎQ以便更好地辑ֈ我们的目的?</p><p>  七:守护U程 </p><p>??守护U程是一cȝD的U程Q它和普通线E的区别在于它ƈ不是应用E序的核心部分,当一个应用程序的所有非守护U程l止q行Ӟ即仍然有守护线E在q行Q应用程序也终止,反之Q只要有一个非守护U程在运行,应用E序׃会终止。守护线E一般被用于在后Cؓ其它U程提供服务?</p><p>  可以通过调用Ҏ isDaemon() 来判断一个线E是否是守护U程Q也可以调用Ҏ setDaemon() 来将一个线E设为守护线E?</p><p>  八:U程l?</p><p>??U程l是一?Java Ҏ的概念,?Java 中,U程l是cThreadGroup 的对象,每个U程都隶属于唯一一个线E组Q这个线E组在线E创建时指定q在U程的整个生命期内都不能更改。你可以通过调用包含 ThreadGroup cd参数?Thread cL造函数来指定U程属的U程l,若没有指定,则线E缺省地隶属于名?system 的系l线E组?</p><p>???Java 中,除了预徏的系l线E组外,所有线E组都必L式创建。在 Java 中,除系l线E组外的每个U程l又隶属于另一个线E组Q你可以在创建线E组时指定其所隶属的线E组Q若没有指定Q则~省地隶属于pȝU程l。这P所有线E组l成了一以pȝU程lؓ根的树?</p><p>??Java 允许我们对一个线E组中的所有线E同时进行操作,比如我们可以通过调用U程l的相应Ҏ来设|其中所有线E的优先U,也可以启动或d其中的所有线E?</p><p>  Java 的线E组机制的另一个重要作用是U程安全。线E组机制允许我们通过分组来区分有不同安全Ҏ的U程Q对不同l的U程q行不同的处理,q可以通过U程l的分层l构来支持不对等安全措施的采用。Java ?ThreadGroup cL供了大量的方法来方便我们对线E组树中的每一个线E组以及U程l中的每一个线E进行操作?</p><p>  九:ȝ </p><p>??在本文中Q我们讲qC Java 多线E编E的Ҏ面面Q包括创建线E,以及对多个线E进行调度、管理。我们深刻认识到了多U程~程的复杂性,以及U程切换开销带来的多U程E序的低效性,q也促我们认真地思考一个问题:我们是否需要多U程Q何旉要多U程Q?</p><p>??多线E的核心在于多个代码块ƈ发执行,本质特点在于各代码块之间的代码是乱序执行的。我们的E序是否需要多U程Q就是要看这是否也是它的内在特点?</p><p>??假如我们的程序根本不要求多个代码块ƈ发执行,那自然不需要用多U程Q假如我们的E序虽然要求多个代码块ƈ发执行,但是却不要求乱序Q则我们完全可以用一个@环来单高效地实现Q也不需要用多U程Q只有当它完全符合多U程的特ҎQ多U程机制对线E间通信和线E管理的强大支持才能有用武之圎ͼq时使用多线E才是值得的?br /><br />转自Q?a >http://ssby.blogdriver.com/ssby/</a></p><img src ="http://www.tkk7.com/liyingcheng/aggbug/156175.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/liyingcheng/" target="_blank">飘雪</a> 2007-10-26 16:10 <a href="http://www.tkk7.com/liyingcheng/archive/2007/10/26/156175.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java常用学习Q{载)http://www.tkk7.com/liyingcheng/archive/2007/10/26/156123.html飘雪飘雪Fri, 26 Oct 2007 05:52:00 GMThttp://www.tkk7.com/liyingcheng/archive/2007/10/26/156123.htmlhttp://www.tkk7.com/liyingcheng/comments/156123.htmlhttp://www.tkk7.com/liyingcheng/archive/2007/10/26/156123.html#Feedback0http://www.tkk7.com/liyingcheng/comments/commentRss/156123.htmlhttp://www.tkk7.com/liyingcheng/services/trackbacks/156123.html阅读全文

飘雪 2007-10-26 13:52 发表评论
]]>
java虚拟机(转蝲Q?/title><link>http://www.tkk7.com/liyingcheng/archive/2007/10/25/155926.html</link><dc:creator>飘雪</dc:creator><author>飘雪</author><pubDate>Thu, 25 Oct 2007 10:15:00 GMT</pubDate><guid>http://www.tkk7.com/liyingcheng/archive/2007/10/25/155926.html</guid><wfw:comment>http://www.tkk7.com/liyingcheng/comments/155926.html</wfw:comment><comments>http://www.tkk7.com/liyingcheng/archive/2007/10/25/155926.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/liyingcheng/comments/commentRss/155926.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/liyingcheng/services/trackbacks/155926.html</trackback:ping><description><![CDATA[ <p mce_serialized="1"> <strong mce_serialized="1">一、什么是Java虚拟?/strong> </p> <p mce_serialized="1"> <br mce_serialized="1" />     当你谈到Java虚拟机时Q你可能是指Q?br mce_serialized="1" />     1、抽象的Java虚拟?br mce_serialized="1" />     2、一个具体的Java虚拟机实?br mce_serialized="1" />     3、一个运行的Java虚拟机实?/p> <p mce_serialized="1"> <br mce_serialized="1" /> <strong mce_serialized="1">二、Java虚拟机的生命周期</strong> </p> <p mce_serialized="1"> <br mce_serialized="1" />     一个运行中的Java虚拟机有着一个清晰的dQ执行JavaE序。程序开始执行时他才q行Q程序结束时他就停止。你在同一台机器上q行三个E序Q就会有三个q行中的Java虚拟机?br mce_serialized="1" />     Java虚拟机L开始于一个main()ҎQ这个方法必L公有、返回void、直接受一个字W串数组。在E序执行Ӟ你必ȝJava虚拟机指明这个包换main()Ҏ的类名?br mce_serialized="1" />     Main()Ҏ是程序的LQ他被执行的U程初始化ؓE序的初始线E。程序中其他的线E都׃来启动。Java中的U程分ؓ两种Q守护线E?QdaemonQ和普通线E(non-daemonQ。守护线E是Java虚拟׃用的U程Q比如负责垃圾收集的U程是一个守护线E。当Ӟ你也?以把自己的程序设|ؓ守护U程。包含Main()Ҏ的初始线E不是守护线E?br mce_serialized="1" />     只要Java虚拟Zq有普通的U程在执行,Java虚拟机就不会停止。如果有_的权限,你可以调用exit()Ҏl止E序?/p> <p mce_serialized="1"> <br mce_serialized="1" /> <strong mce_serialized="1">三、Java虚拟机的体系l构</strong> </p> <p mce_serialized="1"> <br mce_serialized="1" />     在Java虚拟机的规范中定义了一pd的子pȝ、内存区域、数据类型和使用指南。这些组件构成了Java虚拟机的内部l构Q他们不仅仅为Java虚拟机的实现提供了清晰的内部l构Q更是严D定了Java虚拟机实现的外部行ؓ。?br mce_serialized="1" />     每一个Java虚拟机都׃个类加蝲器子pȝQclass loader subsystemQ,负责加蝲E序中的cdQ类和接口)Qƈ赋予唯一的名字。每一个Java虚拟机都有一个执行引擎(execution engineQ负责执行被加蝲cM包含的指令?br mce_serialized="1" />     E序的执行需要一定的内存I间Q如字节码、被加蝲cȝ其他额外信息、程序中的对象、方法的参数、返回倹{本地变量、处理的中间变量{等。Java虚拟机将 q些信息l统保存在数据区Qdata areasQ中。虽然每个Java虚拟机的实现中都包含数据区,但是Java虚拟范对数据区的规定却非常的抽象。许多结构上的细节部分都留给?Java虚拟机实现者自己发挥。不同Java虚拟机实C的内存结构千差万别。一部分实现可能占用很多内存Q而其他以下可能只占用很少的内存;一些实现可 能会使用虚拟内存Q而其他的则不使用。这U比较精炼的Java虚拟机内存规U,可以使得Java虚拟机可以在q泛的^C被实现?br mce_serialized="1" />     数据Z的一部分是整个程序共有,其他部分被单独的U程控制。每一个Java虚拟机都包含Ҏ区(method areaQ和堆(heapQ,他们都被整个E序׃n。Java虚拟机加载ƈ解析一个类以后Q将从类文g中解析出来的信息保存与方法区中。程序执行时创徏?对象都保存在堆中。?br mce_serialized="1" />     当一个线E被创徏Ӟ会被分配只属于他自己的PC寄存器“pc register”(E序计数器)和Java堆栈QJava stackQ。当U程不掉用本地方法时QPC寄存器中保存U程执行的下一条指令。Java堆栈保存了一个线E调用方法时的状态,包括本地变量、调用方法的 参数、返回倹{处理的中间变量。调用本地方法时的状态保存在本地Ҏ堆栈中(native method stacksQ,可能再寄存器或者其他非q_独立的内存中?br mce_serialized="1" />     Java堆栈有堆栈块Qstack frames (or frames)Q组成。堆栈块包含JavaҎ调用的状态。当一个线E调用一个方法时QJava虚拟Z一个新的块压到Java堆栈中,当这个方法运行结束时QJava虚拟Z对应的块弹出ƈ抛弃?br mce_serialized="1" />     Java虚拟Z使用寄存器保存计的中间l果Q而是用Java堆栈在存放中间结果。这是的Java虚拟机的指o更紧凑,也更Ҏ在一个没有寄存器的设备上实现Java虚拟机。?br mce_serialized="1" />     图中的Java堆栈中向下增长的QPC寄存器中U程三ؓ灰色Q是因ؓ它正在执行本地方法,他的下一条执行指令不保存在PC寄存器中?/p> <p mce_serialized="1"> <br mce_serialized="1" /> <strong mce_serialized="1">四、数据类型(Data TypesQ?/strong> </p> <p mce_serialized="1"> <br mce_serialized="1" />     所有Java虚拟Z使用的数据都有确定的数据cdQ数据类型和操作都在Java虚拟范中严格定义。Java中的数据cd分ؓ原始数据cd Qprimitive typesQ和引用数据cdQreference typeQ。引用类型依赖于实际的对象,但不是对象本w。原始数据类型不依赖于Q何东西,他们是本n表示的数据?br mce_serialized="1" />所有JavaE序语言中的原始 数据cdQ都是Java虚拟机的原始数据cdQ除了布型QbooleanQ。当~译器将Java源代码编译ؓ自己码时Q用整型(intQ或者字节型 QbyteQ去表示布尔型。在Java虚拟Z使用整数0表示布尔型的falseQ用非零整数表C布型的trueQ布数l被表示为字节数l,虽然?们可能会以字节数l或者字节块Qbit fieldsQ保存在堆中?br mce_serialized="1" />     除了布尔型,其他Java语言中的原始cd都是Java虚拟Z的数据类型。在Java中数据类型被分ؓQ整形的byteQshortQintQlongQchar和Q点型的floatQdouble。Java语言中的数据cd在Q何主Z都有同样的范围。?br mce_serialized="1" />     在Java虚拟Zq存在一个Java语言中不能用的原始数据cdq回值类型(returnValueQ。这U类型被用来实现JavaE序中的“finally clauses”,具体的参?8章的“Finally Clauses”?br mce_serialized="1" />     引用cd可能被创ZؓQ类cdQclass typeQ,接口cdQinterface typeQ,数组cdQarray typeQ。他们都引用被动态创建的对象。当引用cd引用nullӞ说明没有引用M对象?br mce_serialized="1" />     Java虚拟范只定义了每一U数据类型表C的范围Q没有定义在存储时每U类型占用的I间。他们如何存储由Java虚拟机的实现者自己决定。关于Q点型更多信息参见14章“Floating Point Arithmetic”?</p> <blockquote dir="ltr" mce_serialized="1"> <div mce_serialized="1">TypeRange<br mce_serialized="1" />byte8-bit signed two's complement integer (-27 to 27 - 1, inclusive)<br mce_serialized="1" />short16-bit signed two's complement integer (-215 to 215 - 1, inclusive)<br mce_serialized="1" />int32-bit signed two's complement integer (-231 to 231 - 1, inclusive)<br mce_serialized="1" />long64-bit signed two's complement integer (-263 to 263 - 1, inclusive)<br mce_serialized="1" />char16-bit unsigned Unicode character (0 to 216 - 1, inclusive)<br mce_serialized="1" />float32-bit IEEE 754 single-precision float<br mce_serialized="1" />double64-bit IEEE 754 double-precision float<br mce_serialized="1" />returnValueaddress of an opcode within the same method<br mce_serialized="1" />referencereference to an object on the heap, or null</div> </blockquote> <div mce_serialized="1"> <strong mce_serialized="1">五、字节长?/strong> </div> <div mce_serialized="1"> <br mce_serialized="1" />     Java虚拟Z最的数据单元式字QwordQ,其大由Java虚拟机的实现者定义。但是一个字的大必够容UbyteQshortQintQ?charQfloatQreturnValueQreferenceQ两个字必须_容纳longQdouble。所以虚拟机的实现者至提供的字不能小 ?1bits的字Q但是最好选择特定q_上最有效率的字长?br mce_serialized="1" />     在运行时QJavaE序不能军_所q行机器的字ѝ字长也不会影响E序的行为,他只是在Java虚拟Z的一U表现方式?/div> <div mce_serialized="1"> <br mce_serialized="1" /> <strong mce_serialized="1"> </strong> </div> <div mce_serialized="1"> <strong mce_serialized="1">六、类加蝲器子pȝ</strong> </div> <div mce_serialized="1"> <br mce_serialized="1" />     Java虚拟Z的类加蝲器分ZU:原始cd载器Qprimordial class loaderQ和cd载器对象Qclass loader objectsQ。原始类加蝲器是Java虚拟机实现的一部分Q类加蝲器对象是q行中的E序的一部分。不同类加蝲器加载的c被不同的命名空间所分割?br mce_serialized="1" />     cd载器调用了许多Java虚拟Z其他的部分和java.lang包中的很多类。比如,cd载对象就是java.lang.ClassLoader子类 的实例,ClassLoadercM的方法可以访问虚拟机中的cd载机Ӟ每一个被Java虚拟机加载的c都会被表示Z?java.lang.Classcȝ实例。像其他对象一Pcd载器对象和Class对象都保存在堆中Q被加蝲的信息被保存在方法区中?br mce_serialized="1" />     1、加载、连接、初始化QLoading, Linking and InitializationQ?br mce_serialized="1" />cd载子pȝ不仅仅负责定位ƈ加蝲cLӞ他按照以下严格的步骤作了很多其他的事情:Q具体的信息参见W七章的“类的生命周期”)<br mce_serialized="1" />          1Q、加载:Lq导入指定类型(cd接口Q的二进制信?br mce_serialized="1" />          2Q、连接:q行验证、准备和解析<br mce_serialized="1" />               ①验证:保导入cd的正?br mce_serialized="1" />               ②准备:为类型分配内存ƈ初始化ؓ默认?br mce_serialized="1" />               ③解析:字W引用解析ؓ直接饮用<br mce_serialized="1" />          3Q、初始化Q调用Java代码Q初始化cd量ؓ合适的?br mce_serialized="1" />     2、原始类加蝲器(The Primordial Class LoaderQ?br mce_serialized="1" />     每个Java虚拟机都必须实现一个原始类加蝲器,他能够加载那些遵守类文g格式q且被信ȝcR但是,Java虚拟机的规范q没有定义如何加载类Q这?Java虚拟机实现者自己决定。对于给定类型名的类型,原始莱加载器必须扑ֈ那个cd名加?class”的文gq加载入虚拟Z?br mce_serialized="1" />     3、类加蝲器对?br mce_serialized="1" />     虽然cd载器对象是JavaE序的一部分Q但是ClassLoadercM的三个方法可以访问Java虚拟Z的类加蝲子系l?br mce_serialized="1" />          1Q、protected final Class defineClass(?Q用这个方法可以出入一个字节数l,定义一个新的类型?br mce_serialized="1" />          2Q、protected Class findSystemClass(String name)Q加载指定的c,如果已经加蝲Q就直接q回?br mce_serialized="1" />          3Q、protected final void resolveClass(Class c)QdefineClass()Ҏ只是加蝲一个类Q这个方法负责后l的动态连接和初始化?br mce_serialized="1" />     具体的信息,参见W八章“连接模型”( The Linking ModelQ?br mce_serialized="1" />     4、命名空?br mce_serialized="1" />     当多个类加蝲器加载了同一个类ӞZ保证他们名字的唯一性,需要在cd前加上加载该cȝcd载器的标识。具体的信息Q参见第八章“连接模型”( The Linking ModelQ?/div> <div mce_serialized="1"> <br mce_serialized="1" /> <strong mce_serialized="1">七、方法区QThe Method AreaQ?/strong> </div> <div mce_serialized="1"> <strong mce_serialized="1"> <br mce_serialized="1" /> </strong>     在Java虚拟ZQ被加蝲cd的信息都保存在方法区中。这写信息在内存中的l织形式p拟机的实现者定义,比如Q虚拟机工作在一个“little- endian”的处理器上Q他可以将信息保存为“little-endian”格式的Q虽然在JavacL件中他们是以“big-endian”格式保 存的。设计者可以用最适合q地机器的表C格式来存储数据Q以保证E序能够以最快的速度执行。但是,在一个只有很内存的讑֤上,虚拟机的实现者就不会占用 很大的内存?br mce_serialized="1" />     E序中的所有线E共享一个方法区Q所以访问方法区信息的方法必LU程安全的。如果你有两个线E都d载一个叫Lava的类Q那只能׃个线E被容许d载这个类Q另一个必ȝ待?br mce_serialized="1" />     在程序运行时Q方法区的大是可变的,E序在运行时可以扩展。有些Java虚拟机的实现也可以通过参数也订制方法区的初始大,最值和最大倹{?br mce_serialized="1" />     ҎZ可以被垃圾收集。因为程序中的内q加蝲器动态加载,所有类可能变成没有被引用(unreferencedQ的状态。当cd成这U状态时Q他可 能被垃圾攉掉。没有加载的cd括两U状态,一U是真正的没有加载,另一个种是“unreferenced”的状态。详l信息参见第七章的类的生命周?QThe Lifetime of a ClassQ?br mce_serialized="1" />     1、类型信息(Type InformationQ?br mce_serialized="1" />          每一个被加蝲的类型,在Java虚拟Z都会在方法区中保存如下信息:<br mce_serialized="1" />          1Q、类型的全名QThe fully qualified name of the typeQ?br mce_serialized="1" />          2Q、类型的父类型的全名Q除非没有父cdQ或者弗雷Ş式java.lang.ObjectQ(The fully qualified name of the typeTs direct superclassQ?br mce_serialized="1" />          3Q、给cd是一个类q是接口Qclass or an interfaceQ(Whether or not the type is a class Q?br mce_serialized="1" />          4Q、类型的修饰W(publicQprivateQprotectedQstaticQfinalQvolatileQtransient{)QThe typeTs modifiersQ?br mce_serialized="1" />          5Q、所有父接口全名的列表(An ordered list of the fully qualified names of any direct superinterfacesQ?br mce_serialized="1" />          cd全名保存的数据结构由虚拟机实现者定义。除此之外,Java虚拟要ؓ每个cd保存如下信息Q?br mce_serialized="1" />          1Q、类型的帔R池(The constant pool for the typeQ?br mce_serialized="1" />          2Q、类型字D늚信息QField informationQ?br mce_serialized="1" />          3Q、类型方法的信息QMethod informationQ?br mce_serialized="1" />          4Q、所有的静态类变量Q非帔RQ信息(All class (static) variables declared in the type, except constantsQ?br mce_serialized="1" />          5Q、一个指向类加蝲器的引用QA reference to class ClassLoaderQ?br mce_serialized="1" />          6Q、一个指向Classcȝ引用QA reference to class ClassQ?/div> <p mce_serialized="1"> <br mce_serialized="1" />          1Q、类型的帔R池(The constant pool for the typeQ?br mce_serialized="1" />          帔R池中保存中所有类型是用的有序的常量集合,包含直接帔RQliteralsQ如字符丌Ӏ整数、QҎ的常量,和对cd、字Dc方法的W号引用。常量池 中每一个保存的帔R都有一个烦引,像数组中的字段一栗因为常量池中保存中所有类型用到的类型、字Dc方法的字符引用Q所以它也是动态连接的主要?象。详l信息参见第六章“The Java Class File”?br mce_serialized="1" />          2Q、类型字D늚信息QField informationQ?br mce_serialized="1" />          字段名、字D늱型、字D늚修饰W(publicQprivateQprotectedQstaticQfinalQvolatileQtransient{)、字D在cM定义的顺序?br mce_serialized="1" />          3Q、类型方法的信息QMethod informationQ?br mce_serialized="1" />          Ҏ名、方法的q回值类型(或者是voidQ、方法参数的个数、类型和他们的顺序、字D늚修饰W(publicQprivateQprotectedQstaticQfinalQvolatileQtransient{)、方法在cM定义的顺?br mce_serialized="1" />          如果不是抽象和本地本法还需要保?br mce_serialized="1" />          Ҏ的字节码、方法的操作数堆栈的大小和本地变量区的大(E候有详细信息Q、异常列表(详细信息参见W十七章“Exceptions”。)<br mce_serialized="1" />          4Q、类Q静态)变量QClass VariablesQ?br mce_serialized="1" />          cd量被所有类的实例共享,即不通过cȝ实例也可以访问。这些变量绑定在cMQ而不是类的实例上Q,所以他们是cȝ逻辑数据的一部分。在Java虚拟Z用这个类之前需要ؓcd量(non-finalQ分配内?br mce_serialized="1" />          帔RQfinalQ的处理方式于这U类变量Qnon-finalQ不一栗每一个类型在用到一个常量的时候,都会复制一份到自己的常量池中。常量也像类?量一样保存在ҎZQ只不过他保存在帔R池中。(可能是,cd量被所有实例共享,而常量池是每个实例独有的Q。Non-finalcd量保存ؓ定义他的 cd数据Qdata for the type that declares themQ的一部分Q而final帔R保存Z用他的类型数据(data for any type that uses themQ的一部分。详情参见第六章“The Java Class FileThe Java Class File?br mce_serialized="1" />          5Q、指向类加蝲器的引用QA reference to class ClassLoaderQ?br mce_serialized="1" />          每一个被Java虚拟机加载的cdQ虚拟机必须保存q个cd是否由原始类加蝲器或者类加蝲器加载。那些被cd载器加蝲的类型必M存一个指向类加蝲器的?用。当cd载器动态连接时Q会使用q条信息。当一个类引用另一个类Ӟ虚拟机必M存那个被引用的类型是被同一个类加蝲器加载的Q这也是虚拟机维护不同命 名空间的q程。详情参见第八章“The Linking Model?br mce_serialized="1" />          6Q、指向Classcȝ引用QA reference to class ClassQ?br mce_serialized="1" />          Java虚拟Zؓ每一个加载的cd创徏一个java.lang.Classcȝ实例。你也可以通过ClasscȝҎQ?br mce_serialized="1" />public static Class forName(String className)来查找或者加载一个类Qƈ取得相应的Classcȝ实例。通过q个Classcȝ实例Q我们可以访问Java虚拟机方法区中的信息。具体参照ClasscȝJavaDoc?br mce_serialized="1" />     2、方法列表(Method TablesQ?br mce_serialized="1" />     Z更有效的讉K所有保存在ҎZ的数据,q些数据的存储结构必ȝq仔l的设计。所有方法区中,除了保存了上边的那些原始信息外,q有一个ؓ了加快存 取速度而设计的数据l构Q比如方法列表。每一个被加蝲的非抽象c,Java虚拟机都会ؓ他们产生一个方法列表,q个列表中保存了q个cd能调用的所有实?Ҏ的引用,报错那些父类中调用的Ҏ。详情参见第八章“The Linking Model?</p> <p mce_serialized="1"> <strong mce_serialized="1">八、堆<br mce_serialized="1" /></strong>     当JavaE序创徏一个类的实例或者数l时Q都在堆中ؓ新的对象分配内存。虚拟机中只有一个堆Q所有的U程都共享他?br mce_serialized="1" />     1、垃圾收集(Garbage CollectionQ?br mce_serialized="1" />     垃圾攉是释放没有被引用的对象的主要Ҏ。它也可能会Z减少堆的片Q而移动对象。在Java虚拟机的规范中没有严格定义垃圾收集,只是定义一个Java虚拟机的实现必须通过某种方式理自己的堆。详情参见第九章“Garbage Collection”?br mce_serialized="1" />     2、对象存储结构(Object RepresentationQ?br mce_serialized="1" />     Java虚拟机的规范中没有定义对象怎样在堆中存储。每一个对象主要存储的是他的类和父cM定义的对象变量。对于给定的对象的引用,虚拟机必d耨很快的 定位到这个对象的数据。另为,必须提供一U通过对象的引用方法对象数据的ҎQ比如方法区中的对象的引用,所以一个对象保存的数据中往往含有一个某UŞ?指向Ҏ区的指针?br mce_serialized="1" />     一个可能的堆的设计是将堆分Z个部分:引用池和对象池。一个对象的引用是指向引用池的本地指针。每一个引用池中的条目都包含两个部分:指向对象池中?象数据的指针和方法区中对象类数据的指针。这U设计能够方便Java虚拟机堆片的整理。当虚拟机在对象池中Ud一个对象的时候,只需要修改对应引用池?的指针地址。但是每ơ访问对象的数据都需要处理两ơ指针。下图演CZq种堆的设计。在W九章的“垃圾收集”中的HeapOfFish Applet演示了这U设计。?br mce_serialized="1" />     另一U堆的设计是Q一个对象的引用是一个指向一堆数据和指向相应对象的偏UL针。这U设计方便了对象的访问,可是对象的移动要变的异常复杂。下图演CZq种设计 <br mce_serialized="1" />     当程序试囑ְ一个对象{换ؓ另一U类型时Q虚拟机需要判断这U{换是否是q个对象的类型,或者是他的父类型。当E序适用instanceof语句的时候也 会做cM的事情。当E序调用一个对象的ҎӞ虚拟机需要进行动态绑定,他必d断调用哪一个类型的Ҏ。这也需要做上面的判断?br mce_serialized="1" />     无论虚拟机实现者用哪一U设计,他都可能为每一个对象保存一个类似方法列表的信息。因Z可以提升对象Ҏ调用的速度Q对提升虚拟机的性能非常重要Q但 是虚拟机的规范中比没有要求必d现类似的数据l构。下图描qCq种l构。图中显CZ一个对象引用相兌的所有的数据l构Q包括:<br mce_serialized="1" />          1Q、一个指向类型数据的指针<br mce_serialized="1" />          2Q、一个对象的Ҏ列表。方法列表是一个指向所有可能被调用对象Ҏ的指针数l。方法数据包括三个部分:操作码堆栈的大小和方法堆栈的本地变量区;Ҏ的字节码Q异常列表?br mce_serialized="1" />          每一个Java虚拟Z的对象必d联一个用于同步多U程的lock(mutex)。同一时刻Q只能有一个对象拥有这个对象的锁。当一个拥有这个这个对?的锁Q他可以多ơ申误个锁Q但是也必须释放相应ơ数的锁才能真正释放q个对象锁。很多对象在整个生命周期中都不会被锁Q所以这个信息只有在需要时才需 要添加。很多Java虚拟机的实现都没有在对象的数据中包含“锁定数据”,只是在需要时才生成相应的数据。除了实现对象的锁定Q每一个对象还逻辑兌C 个“wait set”的实现。锁定帮l线E独立处理共享的数据Q不需要妨其他的U程。“wait set”帮l线E协作完成同一个目标。“wait set”往往通过Objectcȝwait()和notify()Ҏ来实现。?br mce_serialized="1" />     垃圾攉也需要堆中的对象是否被关联的信息。Java虚拟范中指出垃圾攉一个运行一个对象的finalizerҎ一ơ,但是容许 finalizerҎ重新引用q个对象Q当q个对象再次不被引用Ӟ׃需要再ơ调用finalizeҎ。所以虚拟机也需要保存finalizeҎ 是否q行q的信息。更多信息参见第九章的“垃圾收集?br mce_serialized="1" />     3、数l的保存QArray RepresentationQ?br mce_serialized="1" />在Java 中,数组是一U完全意义上的对象,他和对象一样保存在堆中、有一个指向Classcd例的引用。所有同一l度和类型的数组拥有同样的ClassQ数l的?度不做考虑。对应Class的名字表CZؓl度和类型。比如一个整型数据的Class为“[I”,字节型三l数lClass名ؓ“[[[B”,两维对象数据 Class名ؓ“[[Ljava.lang.Object”?br mce_serialized="1" />多维数组被表CZؓ数组的数l,如下图: <br mce_serialized="1" />     数组必须在堆中保存数l的长度Q数l的数据和一些对象数l类型数据的引用。通过一个数l引用的Q虚拟机应该能够取得一个数l的长度Q通过索引能够讉K特定 的数据,能够调用Object定义的方法。Object是所有数据类的直接父cR更多信息参见第六章“类文g”?/p> <p mce_serialized="1"> <br mce_serialized="1" /> <strong mce_serialized="1">九、PC寄存器(E序计数器)QThe Program CounterQ?/strong> </p> <p mce_serialized="1"> <br mce_serialized="1" />     每一个线E开始执行时都会被创Z个程序计数器。程序计数器只有一个字长(wordQ,所以它能够保存一个本地指针和returnValue。当U程执行 ӞE序计数器中存放了正在执行指令的地址Q这个地址可以使一个本地指针,也可以一个从Ҏ字节码开始的偏移指针。如果执行本地方法,E序计数器的值没 有被定义?/p> <p mce_serialized="1"> <br mce_serialized="1" /> <strong mce_serialized="1">十、Java堆栈QThe Java StackQ?/strong> </p> <p mce_serialized="1"> <br mce_serialized="1" />     当一个线E启动时QJava虚拟ZZ创徏一个Java堆栈。Java堆栈用一些离散的framecȝ录线E的状态。Java虚拟机堆Java堆栈的操作只有两U:压入和弹出frames?br mce_serialized="1" />     U程中正在执行的Ҏ被称为当前方法(current methodQ,当前Ҏ所对应的frame被称为当前Qcurrent frameQ。定义当前方法的c被UCؓ当前c(current classQ,当前cȝ帔R池被UCؓ当前帔R池(current constant pool.Q。当U程执行ӞJava虚拟Z跟踪当前cd当前帔R池。但U程操作保存在中的数据Ӟ他只操作当前帧的数据?br mce_serialized="1" />     当线E调用一个方法时Q虚拟机会生成一个新的Qƈ压入U程的Java堆栈。这个新的变成当前帧。当Ҏ执行Ӟ他用当前保存Ҏ的参数、本地变 量、中间结构和其他数据。方法有两种退出方式:正常退出和异常推出。无论方法以哪一U方式推出,Java虚拟机都会弹出ƈ丢弃Ҏ的Q上一个方法的帧变 为当前?br mce_serialized="1" />     所有保存在帧中的数据都只能被拥有它的线E访问,U程不能讉K其他U程的堆栈中的数据。所以,讉KҎ的本地变量时Q不需要考虑多线E同步?br mce_serialized="1" />     和方法区、堆一PJava堆栈不需要连l的内存I间Q它可以被保存在一个分散的内存I间或者堆上。堆栈具体的数据和长度都有Java虚拟机的实现者自己定义。一些实现可能提供了执行堆栈最大值和最值的Ҏ?/p> <p mce_serialized="1"> <br mce_serialized="1" /> <strong mce_serialized="1">十一、堆栈QThe Stack FrameQ?/strong> </p> <p mce_serialized="1"> <br mce_serialized="1" />     堆栈帧包含三部分Q本地变量、操作数堆栈和数据。本地变量和操作数堆栈的大小都是一字(wordQؓ单位的,他们在编译就已经定。数据的大取决于 不同的实现。当E序调用一个方法时Q虚拟机从类数据中取得本地变量和操作数堆栈的大小Q创Z个合适大和帧,然后压入Java堆栈中?br mce_serialized="1" />     1、本地变量(Local VariablesQ?br mce_serialized="1" />     本地变量在Java堆栈帧中被组lؓ一个从0计数的数l,指o通过提供他们的烦引从本地变量Z取得相应的倹{Int,float,reference, returnValue占一个字Qbyte,short,char被{换成int然后存储Qlong和doubel占两个字?br mce_serialized="1" />     指o通过提供两个字烦引中的前一个来取得long,doubel的倹{比如一个long的值存储在索引3Q?上,指o可以通过3来取得这个longcd的倹{?br mce_serialized="1" />     本地变量Z包含了方法的参数和本地变量。编译器方法的参数以他们申明的序攑֜数组的前面。但是编译器却可以将本地变量L排列在本地变量数l中Q甚至两个本地变量可以公用一个地址Q比如,当两个本地变量在两个不交叠的区域内,像循环变量i,j?br mce_serialized="1" />     虚拟机的实现者可以用Q何结构来描述本地变量Z的数据,虚拟范中没有定义如何存储long和doubel?br mce_serialized="1" />     2、操作数堆栈QOperand StackQ?br mce_serialized="1" />     向本地变量一P操作数堆栈也被组lؓ一个以字ؓ单位的数l。但是不像本地变量那样通过索引讉KQ而是通过push和pop值来实现讉K的。如果一个指令push一个值到堆栈中,那么下一个指令就可以popq且使用q个倹{?br mce_serialized="1" />     操作数堆栈不像程序计数器那样不可以被指o直接讉KQ指令可以直接访问操作数堆栈。Java虚拟机是一个以堆栈为基Q而不是以寄存器ؓ基础的,因ؓ它的 指o从堆栈中取得操作敎ͼ而不是同寄存器中。当Ӟ指o也可以从其他地方ȝ操作敎ͼ比如指o后面的操作码Q或者常量池。但是Java虚拟机指令主要是?操作数堆栈中取得他们需要的操作数?br mce_serialized="1" />     Java虚拟机将操作数堆栈视为工作区Q很多指令通过先从操作数堆栈中pop|在处理完以后再将l果push回操作数堆栈。一个add的指令执行过E如 下图所C:先执行iload_0和iload_1两条指o需要相加的两个敎ͼ从本地方法区中取出,qpush到操作数堆栈中;然后执行iadd指oQ现 popZ个|相加Qƈ结果puspq操作数堆栈中;最后执行istore_2指oQpop出结果,赋值到本地ҎZ。?br mce_serialized="1" />     3、数据QFrame DataQ?br mce_serialized="1" />     处理本地变量和操作数堆栈以外Qjava堆栈帧还包括了ؓ了支持常量池Q方法返回值和异常分发需要的数据Q他们被保存在数据中?br mce_serialized="1" />     当虚拟机遇到使用指向帔R池引用的指oӞ׃通过帧数据中指向帔R区的指针来访问所需要的信息。前面提到过Q常量区中的引用在最开始时都是W号引用。即使当虚拟机检查这些引用时Q他们也是字W引用。所以虚拟机需要在q时转换q个引用?br mce_serialized="1" />     当一个方法正常返回时Q虚拟机需要重建那个调用这个方法的Ҏ的堆栈。如果执行完的方法有q回|虚拟机就需要将q个值pushq调用方法的哪个操作数堆栈中?br mce_serialized="1" />     帧数据中也包含虚拟机用来处理异常的异常表的引用。异常表定义了一个被catch语句保护的一D字节码。每一个异常表中的个体又包含了需要保护的字节玛的 范围Q和异常被捕捉到旉要执行的字节码的位置。当一个方法抛Z个异常时QJava虚拟机就是用异常表去判断如何处理q个异常。如果虚拟机扑ֈ了一个匹 配的catchQ他׃控制权交给catch语句。如果没有找到匹配的catchQ方法就会异常返回,然后再调用的Ҏ中l这个过E?br mce_serialized="1" />     除了以上的三个用途外Q数据q可能包含一些依赖于实现的数据,比如调试的信息?/p> <p mce_serialized="1"> <br mce_serialized="1" /> <strong mce_serialized="1">十二、本地方法堆?/strong> </p> <p mce_serialized="1"> <br mce_serialized="1" />     本地ҎZ赖于虚拟机的不同实现。虚拟机的实现者可以自己决定用哪一U机制去执行本地Ҏ?br mce_serialized="1" />     M本地Ҏ接口QNative Method InterfaceQ都使用某种形式的本地方法堆栈。?/p> <p mce_serialized="1"> <br mce_serialized="1" /> <strong mce_serialized="1">十三、执行引?/strong> </p> <p mce_serialized="1"> <br mce_serialized="1" />     一个java虚拟机实现的核心是执行引擎。在Java虚拟范,执行引擎被描qCؓ一pd的指令。对于每一个指令,规范都描qC他们应该做什么,但是没有说要如何d?br mce_serialized="1" />     1、指令集<br mce_serialized="1" />     在Java虚拟Z一个方法的字节码流是一个指令的序列。每一个指令由一个字节的操作码(OpcodeQ和可能存在的操作数QOperandsQ。操?码指C去做什么,操作数提供一些执行这个操作码可能需要的额外的信息。一个抽象的执行引擎每次执行一个指令。这个过E发生在每一个执行的U程中?br mce_serialized="1" />有时Q执行引擎可能会遇到一个需要调用本地方法的指oQ在q种情况下,执行引擎会去试图调用本地ҎQ但本地Ҏq回Ӟ执行引擎会l执行字节码中的下一个指令。本地方法也可以看成对Java虚拟Z的指令集的一U扩充?br mce_serialized="1" />     军_下一步执行那一条指令也是执行引擎工作的一部分。执行引擎有三种Ҏd得下一条指令。多数指令会执行跟在他会面的指oQ一些像gotoQ?return的指令,会在他们执行的时候决定他们的下一条指令;当一个指令抛出异常时Q执行引擎通过匚wcatch语句来决定下一条应该执行的指o?br mce_serialized="1" />     q_独立性、网l移动性、安全性左右了Java虚拟机指令集的设计。^台独立性是指o集设计的主要影响因素之一。基于堆栈的l构使得Java虚拟机可以在 更多的^C实现。更的操作码,紧凑的结构得字节码可以更有效的利用|络带宽。一ơ性的字节码验证,使得字节码更安全Q而不影响太多的性能?br mce_serialized="1" />     2、执行技?br mce_serialized="1" />     许多U执行技术可以用在Java虚拟机的实现中:解释执行Q及时编译(just-in-time compilingQ,hot-spot compiling,native execution in silicon?br mce_serialized="1" />     3、线E?br mce_serialized="1" />     Java虚拟范定义了一Uؓ了在更多q_上实现的U程模型。JavaU程模型的一个目标时可以利用本地U程。利用本地线E可以让JavaE序中的U程能过在多处理器机器上真正的同时执行?br mce_serialized="1" />     JavaU程模型的一个代价就是线E优先Q一个JavaU程可以?-10的优先上运行?最低,10最高。如果设计者用了本地U程Q他们可能将q?10个优先映射到本C先上。Java虚拟范只定义了,高一点优先的线E可以却一些cpu旉Q低优先U的U程在所有高优先U线E都堵塞Ӟ?可以获取一些cpu旉Q但是这没有保证Q低优先U的U程在高优先U线E没有堵塞时不可以获得一定的cpu旉。因此,如果需要在不同的线E间协作Q你?M用的“同步(synchronizatoinQ”?br mce_serialized="1" />     同步意味着两个部分Q对象锁Qobject lockingQ和U程{待、激z?thread wait and notify)。对象锁帮助U程可以不受其他U程的干扰。线E等待、激zd以让不同的线E进行协作?br mce_serialized="1" />     在Java虚拟机的规范中,JavaU程被描qCؓ变量、主内存、工作内存。每一个Java虚拟机的实例都有一个主内存Q他包含了所有程序的变量Q对象、数l合cd量。每一个线E都有自q工作内存Q他保存了哪些他可能用到的变量的拯。规则:<br mce_serialized="1" />          1Q、从d存拷贝变量的值到工作内存?br mce_serialized="1" />          2Q、将工作内存中的值写会主内存?br mce_serialized="1" />     如果一个变量没有被同步化,U程可能以Q何顺序更C内存中的变量。ؓ了保证多U程E序的正的执行Q必M用同步机制?/p> <p mce_serialized="1"> <br mce_serialized="1" /> <strong mce_serialized="1">十四、本地方法接口(Native Method InterfaceQ?/strong> </p> <p mce_serialized="1"> <br mce_serialized="1" />     Java虚拟机的实现q不是必d现本地方法接口。一些实现可能根本不支持本地Ҏ接口。Sun的本地方法接口是JNI(Java Native Interface)?/p> <p mce_serialized="1"> <br mce_serialized="1" /> <strong mce_serialized="1">十五、现实中的机器(The Real MachineQ?/strong> </p> <strong mce_serialized="1"> <p mce_serialized="1"> <br mce_serialized="1" />十六、数学方法:仿真(Eternal Math : A Simulation)<br />本文转自Q?a href="/cheneyfree">http://www.tkk7.com/cheneyfree</a></p> </strong> <img src ="http://www.tkk7.com/liyingcheng/aggbug/155926.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/liyingcheng/" target="_blank">飘雪</a> 2007-10-25 18:15 <a href="http://www.tkk7.com/liyingcheng/archive/2007/10/25/155926.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>?MyEclipse 5.1GA 上?XFire ~写 Web Service Q{载)http://www.tkk7.com/liyingcheng/archive/2007/10/24/155602.html飘雪飘雪Wed, 24 Oct 2007 07:11:00 GMThttp://www.tkk7.com/liyingcheng/archive/2007/10/24/155602.htmlhttp://www.tkk7.com/liyingcheng/comments/155602.htmlhttp://www.tkk7.com/liyingcheng/archive/2007/10/24/155602.html#Feedback0http://www.tkk7.com/liyingcheng/comments/commentRss/155602.htmlhttp://www.tkk7.com/liyingcheng/services/trackbacks/155602.html

?MyEclipse 5.1GA 上?XFire ~写 Web Service

Posted on 2006-11-16 00:04 Stephen Wong 阅读(1320) 评论(0)  ~辑  收藏 所属分c? WebService ?a >Java ?a >J2EE ?a >Java 开发环?/font>
   来源Q?a >http://tech.it168.com/j/e/2006-10-28/200610281432707.shtml    Q?font color="#ff0000">U色部分为实验批?/font>Q?br />
附:MyEclipse 5.0 官方提供?strong>图文教程Q?br />
http://www.myeclipseide.com/ContentExpress-display-ceid-81.html#webservices

   开发环?/strong>
    Sun Java 5+ Eclipse 3.2 +MyEclipse 5.0.0. 

    概述 

    本文介绍了用MyEclipse Web Service来迅速开发和试一个HelloWorld Web Service,其中包括: 
    1. 介绍了MyEclipse Web Services的基本概念?br />    2. 创徏一个MyEclipse Web Services工程 
    3. 创徏一个简单的HelloWorld Web Service 
    4. 在Web容器?如Tomcat 5中部|Web Service 
    5. 使用Web Services Explorer来测试部|的Web Services 

    XFire Java SOAP框架概述 
    MyEclipse Web Services是徏立在XFire Java SOAP框架和工具基上的, XFire是一Ƒּ源的Java SOAP框架。它拥有一个轻量的信息处理模块,通过STAX来与SOAP信息相结合。提供了一个工作在Web Services下的单APIQ支持POJO和schema开? XFire支持 Web Services standards,Spring 整合, 支持JBI , 支持 JAXB ,XMLBeans,Java 5 和JAX-WS.q支持HTTP, JMS, XMPP, In-memory传输协议. 

    一. 创徏Web Service工程 

    在MyEclipse 5.0中引入了一个新的工E类型即Web Service工程,该工E扩展了MyEclipse Web Project来支持额外的Web Service配置,开发和部v.本部分将使用Web Services Project wizard来创建和配置一个新的Web Service Projects Web Service Wizard完成下列的动作: 
    创徏MyEclipse J2EE Web Project 
    在工E中的web.xml文g中配|XFire Servlet 
    创徏XFire services.xml配置文g 
    在工E中的构\径中dMyEclipse-XFirecd 
    d一个指定的MyEclipse web project builder?projects文g,以便部vservices.xml文g到它合适的位置.? <webroot>/WEB-INF/classes/META-INF/xfire/ 

    q行Web Service Project Wizard 
    该向导包括三个页? Page-1搜集Web Project配置l节, Page-2搜集XFire配置l节, Page-3在新建的构徏路径中配|XFirecd 
    1. 执行Web Services Project Wizard. 
       1). 选择File>New>Other 
       2). 扩展MyEclipseU类按照J2EE工程的种c?br />       3). 选择Web Services Project然后点击Next,如图所C?br />


    Figure-1: New Project Wizard Launcher 
    2. dProject Name,点击Next


    Figure-2: Page-2, Collecting web configuration details 
    3.在向导的Page-2中添加XFire servlet和service.xml文g的配|信?按照默认的值即?


    Figure-3: XFire servlet and services.xml configuration
    4.在向导的Page-3中选择cdd到工E的构徏路径?其中XFire Core Library是需要的,如果要在工程中开发一个客L应用, XFire HTTP Client Libraries也是需要的.


    Figure-4: Selecting XFire libraries to add to new web service project buildpath 

    5选择Finish完成Web Service工程的创E?br />    Figure-5,昄了新创徏的HelloWorld Web Service工程的组l结?Web Service 工程和一个标准的MyEclipse Web工程很相? XFire Web Service配置元素如图U色区域昄:


    Figure-5: Web services artifacts of a new web service project 

    ? 创徏Web Service-Code-first Strategy 
    在这部分用MyEclipse Web Service Wizardq过使用Code-first Strategy来创Z个HelloWorldServiceCZ. 

    1. 执行MyEclipse Web Service Wizard,有两U方法来执行MyEclipse Web Service Wizard 
    Ҏ1.从MyEclipse perspective toolbar中来执行向导 
    在打开的Web Service Wizard上的workbench上来选择新Web Service按钮 
    Ҏ2.从workbench menubar执行向导 
    1. 从workbench menubar选择: File>New>Other>MyEclipse>Web Service


    Figure-6: Launching Web Service Wizard 

    2. 在Page-1选择HelloWorld 工程q择Create web service from Java bean 
    3. 选择Next到Page-2


    Figure-7: Page-1 of new web service wizard

    4. 填写Web Service的名字HelloWorldService 
    5. 选择Java Source folder或者选择New按钮来新Z个source folder 
    6. 填写Java package或者通过选择Browse按钮来选择一个已l存在的package.也可以选择New按钮来新Z个Java package 
    注意:对Service接口和Service执行的类的默认值是Z所填入Web Service名字来生的. 
    7. 选择Next来初始化Web Service的创E?br />


    Figure-8: Page-2 of new web service wizard. 
    该向g生了IHelloWorldService Java接口和HelloWorldServiceImpl Javac?q且在services.xml配置文g中创Z一?lt;service>实体(如图所C?,注意到example(String message)Ҏ在接口类中?当Web Service部v后作Z个测试操?


    Figure-9: Newly created HelloWorld interface and implementation class 

Web Service 服务端服务接口代?/strong>Q?br />
package org.stephencat.ws;
//Generated by MyEclipse

public interface ISampleService {
    
    
public String example(String message);
    
}

Web Service 服务端服务实C?/strong>Q?br />
package org.stephencat.ws;
//Generated by MyEclipse

public class SampleServiceImpl implements ISampleService {
    
    
public String example(String message) {
        
return message + " This is Xfire !!";
    }
    
}

    
    ? 部vWeb Service Project 
    Web Service可以部v在Q何MyEclipse支持的J2EE应用服务器上,该部分将演示如何在Tomcat 5 Web容器上部|HelloWorld工程. 

    3.1部vHelloWorld Web Service Project 

    Figure-10昄了如何部|HelloWorld应用. 
    1. 从Server Manager中选择Deployer按钮(step-1) 
    2. 在Server Deployments对话框中选择Add to create a new deployment (step-2) 
    3. 在New Deployment对话框中选择HelloWorld工程q择Exploded Archive选项 
    4. 在New Deployment对话框选择Finish来将HelloWorld在Tomcat 5默认的位|中打包为WAR 
    5. 选择OK完成部v


    Figure-10: Three-step deployment process 
    新HelloWorld WAR部v出现在Server Manager视图中Tomcat 5节点?


    Figure-11: Servers Manager View depicting deployed HelloWorld web service project

    ? 启动Tomcat服务器 (?JBoss 服务?/strong>Q?br />
    ? 使用Web Service Explorer试Web Service 
    MyEclipse提供了一个Web Service Explorer来测试Web Service. 
    1. 在MyEclipse perspective中选择toolbar button来执行Web Service Explorer


    Figure-15: Web Services Explorer launch button on workbench toolbar 

    2. 选择WSDL模式(Figure-16) 
    3. 在活动面板中键入HelloWorldService WSDL文档的URL

http://localhost:8080/wstest/services/SampleService?WSDL

Web Service Explorer下载自动生的WSDL文档,该WSDL文档由XFire framework,q生一pd的操作能够调用service. 
    4. 在活动面板中选择example操作q在in0域中键入HelloWorld 
    5. 选择Go按钮来调用在HelloWorldService上的example操作,,l果出现在Status面板?


    Figure-16: Web Services Explorer testing HelloWorldService 

    ? 创徏Java Test客户?/strong> 
    XFire提供了一个动态的代理框架,能够dWSDL文档和创建潜在的消息服务使JavacL执行在Web Service的行?该部分将为HelloWorld Web Service写一个Java Web Service客户端?br />    6.1增加XFirecd配置 
    Z使example client能够在HelloWorld工程中运?需要增加XFire HTTP Clientcd到工E的构徏路径? 
    1. 在Package Explore视图中右击HelloWorld工程选择Build Path>Add Library 
    2. 选择MyEclipse Libraries 
    3. 选择XFire HTTP Client Libraries


    Figure-17: Choosing the XFire HTTP Client Libraries 
    4. 选择Finish 
    6.2创徏HelloWorldClientc?br />    执行Javacd导来创徏HelloWorldClientc?


    Figure-18: HelloWorldClient defined in New Java Class Wizard. 

    Web Service 客户端代?/strong>如下:

package org.stephencat.ws;

import org.codehaus.xfire.*;
import org.codehaus.xfire.service.*;
import org.codehaus.xfire.service.binding.*;
import org.codehaus.xfire.client.*;

import java.net.*;

public class SampleClient {

    
/**
     * 
@param args
     
*/
    
public static void main(String[] args) {
        Service srvcModel 
= new
        ObjectServiceFactory().create(ISampleService.
class);
        XFireProxyFactory factory 
=
           
new XFireProxyFactory(XFireFactory.newInstance().getXFire());
        String url 
=
           
"http://localhost:8080/wstest/services/SampleService";
        
try {
            ISampleService srvc 
= (ISampleService)factory.create(srvcModel, url);
           String result 
= srvc.example("hello world");
           System.out.print(result);
        } 
catch (MalformedURLException e){
           e.printStackTrace();
        }


    }

}

    该段代码定义了创Z个XFire web service proxy的过E?该代理支持POJO IHelloWorldService接口 

    右键点击Run As>Java Application或者Debug As>JavaApplication来运行或调试该程?


飘雪 2007-10-24 15:11 发表评论
]]>
Axis入门学习Q{载)http://www.tkk7.com/liyingcheng/archive/2007/10/22/154916.html飘雪飘雪Mon, 22 Oct 2007 03:24:00 GMThttp://www.tkk7.com/liyingcheng/archive/2007/10/22/154916.htmlhttp://www.tkk7.com/liyingcheng/comments/154916.htmlhttp://www.tkk7.com/liyingcheng/archive/2007/10/22/154916.html#Feedback0http://www.tkk7.com/liyingcheng/comments/commentRss/154916.htmlhttp://www.tkk7.com/liyingcheng/services/trackbacks/154916.html

RSS Feed for beginner

By subscribing to this Really Simple Syndication (RSS) feed, you can preview updates made to this space in any RSS reader or aggregator. RSS allows you to subscribe to feeds from several sources and automatically combines the information into one list. You can quickly browse the list without visiting each site to search for new information of interest to you.

Learn more about RSS

Subscribe to this feed in Live.com

Subscribe to this feed in an aggregator that supports one-click subscription


Using Apache-Axis to develop the WebService (Lesson 4)

 This time, we will begin to write some cases for calling our service.
 Service:
 package server;
 public class SayHello
 {
      public String getName( String name )
      {
            return "hello " + name;
      }
 }
 
 Client:
 public class SimpleSayHelloClient
 {
        public static void main(String [] args) throws Exception {
              String endpoint = http://localhost:8080/learnws/services/SayHello;
              Service service = new Service();
              Call call    = (Call) service.createCall();
              call.setTargetEndpointAddress(new java.net.URL(endpoint));
              call.setOperationName("getName");
              String res = (String) call.invoke(new Object[]{"GuanYabei"});
              System.out.println(res);
         }
 }
 Ok, we have finished our code,now we will publish the service.First, we have to write a .bat file named deploy.bat include words following that :
 set Axis_Lib=E:\workspace\learnws\context\WEB-INF\lib
 set Java_Cmd=java -Djava.ext.dirs=%Axis_Lib%
 set Axis_Servlet=http://localhost:8080/learnws/servlet/AxisServlet
 %Java_Cmd% org.apache.axis.client.AdminClient -l%Axis_Servlet% deploy.wsdd
 This .bat file exits under the src folder.
 We can execute it and we will see a XML file called server-config.wsdd under the WEB-INF folder.
 Well, now we can execute client code and we can see the words "hello GuanYabei".
 
 We can generate cliend code by wsdl file as well. We can visite http://localhost:8080/learnws/services to download the SayHello.wsdl. And then we need a .bat file to generate clinet code by this SayHello.wsdl.
 The bat context is following this:
 set Axis_Lib=E:\workspace\learnws\context\WEB-INF\lib
 set Java_Cmd=java -Djava.ext.dirs=%Axis_Lib%
 set Output_Path=E:\workspace\learnws\src
 set Package=server
 %Java_Cmd% org.apache.axis.wsdl.WSDL2Java -o%Output_Path% -p%Package% SayHello.wsdl
 the bat file called WSDL2Java.bat.
 Executing WSDL2Java.bat, 4 files are generated. they are : SayHello_PortType.java , SayHelloService.java , SayHelloServiceLocator.java and SayHelloSoapBindingStub.java.
 Now we can write client code like this:
 package server;
 import java.rmi.RemoteException;
 import javax.xml.rpc.ServiceException;
 public class SayHelloClient
 {
      /**
        * @param args
        * @throws RemoteException 
        */
         public static void main( String[] args )
         {
                SayHelloService service = new SayHelloServiceLocator();
                SayHello_PortType client = null;
                try
                {
                      client = service.getSayHello();
                }
                catch (ServiceException e)
                {
                       e.printStackTrace();
                }
                String retValue = null;
                try
                {
                       retValue = client.getName("clientname");
                }
                catch (RemoteException e)
                {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                System.out.println(retValue);
         }
 }
 If everything is successful , we will see the words "hello clientname";

Published Date: ? 09 八月 2007 00:42:19 GMT
Read the full item

Using Apache-Axis to develop the WebService (Lesson 3)

Using WSDD to publish your service.
We have shown the how to install and config the Axis for developping the WebServie before this lesson. And We wriet a  simple test to show how to call the services we published, but we often publish our services by a wsdd file in practice instead of the way that turn *.java to *.jws. This time, We'll close to the practice and show how to use WSDD file to publish our services!
 
Now, you can set up a new project for your webservice, my porject's name is learnws(for short learning WebService). its directory structure follow that :
learnws
|--context
    |--WEB-INF
    |   |--lib (axis jars)
    |   |--classes (your webservice classes)
    |--src (your webservice code)
 
OK,please config your tomcat for publishing this webapp,and then copy necessary jars to directory lib.
Please config your web.xml like this:
 
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web
    Application 2.3//EN" "
<web-app>
    <listener>
        <listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class>
    </listener>
   
  <servlet>
    <servlet-name>AxisServlet</servlet-name>
    <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
  </servlet>
  <servlet>
    <servlet-name>AdminServlet</servlet-name>
    <servlet-class> org.apache.axis.transport.http.AdminServlet</servlet-class>
    <load-on-startup>101</load-on-startup>
  </servlet>
  <servlet>
    <servlet-name>SOAPMonitorService</servlet-name>
    <display-name>SOAPMonitorService</display-name>
    <servlet-class>org.apache.axis.monitor.SOAPMonitorService</servlet-class>
    <init-param>
      <param-name>SOAPMonitorPort</param-name>
      <param-value>5001</param-value>
    </init-param>
    <load-on-startup>102</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/servlet/AxisServlet</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>*.jws</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>SOAPMonitorService</servlet-name>
    <url-pattern>/SOAPMonitor</url-pattern>
  </servlet-mapping>
 <!-- uncomment this if you want the admin servlet -->
 <!--
  <servlet-mapping>
    <servlet-name>AdminServlet</servlet-name>
    <url-pattern>/servlet/AdminServlet</url-pattern>
  </servlet-mapping>
 -->
    <session-config>
        <!-- Default to 5 minute session timeouts -->
        <session-timeout>5</session-timeout>
    </session-config>
    <!-- currently the W3C havent settled on a media type for WSDL;
   
http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft
    for now we go with the basic 'it's XML' response -->
  <mime-mapping>
    <extension>wsdl</extension>
     <mime-type>text/xml</mime-type>
  </mime-mapping>
  <mime-mapping>
    <extension>xsd</extension>
    <mime-type>text/xml</mime-type>
  </mime-mapping>
  <welcome-file-list id="WelcomeFileList">
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.jws</welcome-file>
  </welcome-file-list>
</web-app>
 
Well, Now, we need a service, the code follow this:
 
package server;
public class SayHello
{
    public String getName( String name )
    {
         return "hello " + name;
    }
}
 
OK, we should write a deploy.wsdd file for grenterating file server-config.wsdd. Axis will publish our services by server-config.wsdd.
deploy.wsdd :
If you can see the wsdl, you have finished the first step!

Published Date: 一, 06 八月 2007 05:39:16 GMT
Read the full item

How to use Hibernate3.2 Lesson 1

      Hibernate is one of the most popular OR-MAPING tool. At present, its last version is hibernate3.2.4. It is even as titile said, we do not tell you what is hibernate,but I will tell you how to use hibernate! OK, let's begin!
      First, you need to download the hibernate3.2.4.zip and hibernate-tool-3.2.0.zip from the website www.hibernate.org. And then you can unzip these zips.
      Do you have the IDE-Eclipse? If you don't ,you need download it (We suggest you to download eclipse-3.2.2).
      Copy all of the files that we unzip to hibernate-tool-3.2.0.zip to directory "configuration" and "features" under the eclipse home ? No, we needn't do it. We have another way!
      We can make a dirctory "links" under the eclipse-home and make a file. The make file and its name is HibernateTools-3.2.0.beta9a.link.(attention: .link is necessary). The Context of the file is your hibernate-tool-3.2.0's path for example:path=D:\\extends_pugins\\HibernateTools-3.2.0.beta9a (my hibernate-tools folder is HibernateTools-3.2.0.beta9a).
      Well, now, you can start up the Eclipse and you can see the 4 items from the New. Those are Hibernate XML Mapping file, Hibernate Configuration File, Hibernate Console Configuration and Hibernate Reverse Configuration.
      Now, you should set up a project for hibernate in Eclipse. And then, load all of hibernate jars to your lib path. You can set up a DateBase for using hiberate to visite it.
       OK, We have a rest, See you next lesson. bye!
      

Published Date: ? 31 七月 2007 03:33:30 GMT
Read the full item

How can I do ?

 Recently, I found my mood was not good. I didn't know when it was, I have even started to worried about my future!
 What did I want? What did I need? Who can I be wanted? Maybe, I could tell your these answers many years ago, but  now, I don't  know really.
 I have known that I must keep persistent efforts forever. I have known that I am never a lucky boy. Certainly, I have  even known that I should believe in myself and my faith. But now, face to my current conditions, who can tell me how can I do?!
 Now my job is very easy. It is too easy to set my heart at rest! But I don't need a rest, frankly speaking, I need more  money, I need more money that was even my value and ability! I think I need a room which I can show myself!
 Maybe I understand how can I do , maybe or not......
 I pray... I pray that the God blesse me! I don't expect that I will turn to a lucky boy, I do only expect that my repayment will be even my payment!
 
All of words both are nonsense!
 

Published Date: 一, 30 七月 2007 15:01:56 GMT
Read the full item

Using Apache-Axis to develop the WebService (Lesson 2)

Last time We have showed how to install and config the axis1.4. Today we will continue the WebService trip!
As you know, this time, we will show how to develop a simple webservice application. We will use the case of HelloWorld.
1. coding a webservice application
  
   public class HelloWorld
   {
       public String getName( String name )
       {
           return "hello " + name;
       }
   }
   We will copy the file HelloWorld.java to AXIS_HOME and turn HelloWorld.java to HelloWorld.wsdl. And then, we will restart the Tomcat before visiting URL http://localhost:8080/axis/HelloWorld.jws?wsdl.
   You will see a page that display a XML context. The page context is WSDL,it told we what functions were offered by WebService.
ATTENTION :
   Don't setup the java file in a package.
2. coding client and visit HelloWorld by DII.
   If we use DII to visit HelloWorld, we should find operation name and parameterOrder from the page.
  
   import javax.xml.namespace.QName;
   import org.apache.axis.client.Call;
   import org.apache.axis.client.Service;
   public class SayHelloClient
   {
      public static void main( String[] args )
      {
         String point = "http://localhost:8080/axis/HelloWorld.jws";
         Service service = new Service();
         try
         {
             Call call = null;
             call = (Call) service.createCall();
             call.setOperationName(new QName(
                                            point, "getName"));//提供Ҏ?br />             call.setTargetEndpointAddress(new java.net.URL(point));//提供接口地址
             String ret = (String) call.invoke(new Object[]
                                            { "GuanYabei" });//提供接口参数
             System.out.println("return value is " + ret);
          }
          catch (Exception e)
         {
             e.printStackTrace();
         }
      }
   }
   Now you can run this application via your IDE, you can see a word "return value is hello GuanYabei". 

Published Date: ? 25 七月 2007 02:13:09 GMT
Read the full item

Using Apache-Axis to develop the WebService (Lesson 1)

At present, there are two version axis(axis1.x and axis2) in Apache.
But we should understand the axis2 is not update version of axis1.x, so they are different each other.
I will introduce Axis1.4 to my viewers. ^_^
 
Installation And Configuration
 
 
2. unzip axis-bin-1_4.zip and copy webapps\axis to tomcat\webapps\
 
3. unzip axis-src-1_4.zip and copy lib\activation.jar to tomcat\common\lib\
    unzip javamail-1_4.zip and copy mail.jar to tomcat\common\lib\
    upzip xml-security-bin-1_3_0.zip and copy lib\xmlsec-1.3.0.jar to tomcat\common\lib
    copy JDK_HOME\lib\tool.jar to tomcat\common\lib\
 
4. start up Tomcat and visit http://127.0.0.1:8080/axis
    you can see the Apache-AXIS page and click validation link.
    if you can see Axis Happiness Page without "Not Found words", you are successful.
  
5. config envionment variables
   TOMCAT_HOME=D:\Program Files\Apache Software Foundation\Tomcat 5.5
   AXIS_HOME=D:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\axis
   AXIS_LIB=%AXIS_HOME%\WEB-INF\lib
   AXISCLASSPATH=.;%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery-0.2.jar;%AXIS_LIB%\commons-logging-1.0.4.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar;%AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%axis-ant.jar;%TOMCAT_HOME%\common\lib\activation.jar 

Published Date: ? 24 七月 2007 06:24:35 GMT
Read the full item

My new glasses

Last Saturday, I bought a new glasses to instead of old one with me 5 years. The new glasses costed me 230 yuan, my friend, ZhuXixi, help me for choosing it. I like it very much.
The glasses' material is steel. In fact, I think titanium is better than steel, but all glasses style that was made in titanium did not apply me! So, at last, I bought the steel one. I think it looks good very well. its style suited my face. But my friend said I looks like PangLong(a singer and I don't like him),it spoils me -_-!
Now I hope I can bought the second glasses that was made in titanium. 

Published Date: ? 24 七月 2007 01:28:45 GMT
Read the full item

It doesn't matter. I will make persistent effort!

In the afternoon, I went to the TIBCAL Company and  entered for an interview.To my surprise, the position was Technique Supported. Frankly speaking, I didn't even know what to do about that position. The interview was not all right. I had to talk about all words in English. But I knew that my English is very poor. At last, that man tested me had to talk with me in Chinese. I felt shame! Of course, if I only came up against this occasion, I thought I may not feel too bad. Today, July 12th 2007 year, I filed in my knowledge that I am proud of. I did not perfectly answer any question. In fact, some knowledge points were not held by myself too. I need learn more things about software technology and developing skill.
In spite of this, I was not discouraged. I knew this way is very long! I must make persistent effort!

Published Date: ? 12 七月 2007 06:23:30 GMT
Read the full item

Enjoy my dreams

I has wanted to have a notebook-computer('NB' for short) myself since I was still a student at the college. But I did not have enough money to afford to pay it. Now, I earn money more and more, but I find that I can't still afford to pay it because of some reason. Then I changed my mind and I hoped that my firm can buy a NB to me.  But it does not come true.
I dream of having a NB myself. Frankly speaking, I did not think it is only a dream for me in the past. Now I have still believed in that. So I need do my best to earn more money for my dream.
In fact,I think, I'm not really interested in having a NB. I am only interested in the thing that I do make great efforts for my dreams coming true.

Published Date: ? 07 七月 2007 14:18:33 GMT
Read the full item

How can you understand ?

   How can you understand that new sky usually is outside house.

   How can you understand that lover may not apply to gathering.

   How can you understand that losing love is not the incurable disease but only an ache.

   How can you understand that she needn’t follow you forever , in spite of accompanying you in the past.

   How can you understand that concern of friends is not all of sweet talk.

   How can you understand that people who you don’t like to rap to concern you very much.

   How can you understand that people who you depend on don’t love you sometimes.

   How can you understand that you don’t catch up with her because she don’t want to be caught by you.

   How can you understand that you don’t hold her by bearing and connivance.

   How can you understand that being lonely doesn't belong to the love.

   How can you understand that you should not be punished for her fault.

   How can you understand that one person who love you indeed is waiting you at a distance.

  

   The meaning of being lonely is that love is closing to you.

   note:

   incurable disease : l症

   sweet talk : 甜言蜜语

   rap to : ?/span>?说话Q搭?/span>....

   bearing and connivance : 忍受与纵?/span>

   indeed : 真正?/span>

for you ,for me ,for everyone.
Published Date: ? 03 七月 2007 13:43:57 GMT
Read the full item

The Most Valuable Program Language

What is the most valuable program language? you mast have your own answer. let me guess it.
mybe you can tell me that it is C++. well,if you can develop softwares or any applications by it, you will get a good salary! but how much ? I can tell you, 10000 yuan to 15000 yuan for common developers.
mybe you can tell me that it is Java or C#(C sharp). good, beyond all doubt,they are the most popular program language now. but C++'s value is lager than theirs. 
in fact, I asked the same question to others. I do get the true answer is PPT (microsoft office power point). Why it is? We do not develop any softwares with it. Of course, you are right. but the thing that we are talking about is language's value and is not language's function. so if PPT compared with other program language from valuable aspect,it is the most valuable language.
the reason is very simple! other program language can give you a good salary for your job, but I think its value is too small! If you are good at writing PPT, you can obtain the big capital from investors. that's pretty penny!
do you understand now?
 
 
note:
pretty penny : a lot of money

Published Date: ? 29 六月 2007 15:45:02 GMT
Read the full item

The Trip Of The Xingcheng-City

        Last weekend I enjoyed an exciting trip with my friends. This is twice to visited Xingcheng. Last time we enjoyed the trip in last year of October. We arrived at the railway station of Calabash-island City by train in the early morning. Than We went to the Xingcheng City by car. The car covered distance in 30 minutes from Calabash-island to Xingcheng City.

       We arrived at seashore first. I think I like the sea but I can’t swimming. We sat the sand beach and sang. The sky was very dark. I could not see any thing and only hear the sea.

       if you ask me what is interesting for me, I can say “eating shrimps!? We bought a lot of fresh shrimps from fisherfolks. The shrimp’s price is cheaper than Beijing’s. We ate many shrimp. It’s very delicious!

       On Sunday We visited Xingcheng by car. We visited the ancestral wall and nearly every shops. My friend ZhuXixi bought a few of seashell. She like it very much. She had a great many of beautiful seashell. I think her room must be a seashell-museums.

       At last We went home by train. We have a good time!

    note:

   Calabash-island 葫芦?/font>

   shrimp ?/font>


Published Date: ? 28 六月 2007 05:58:15 GMT
Read the full item



飘雪 2007-10-22 11:24 发表评论
]]>
java相关文档下蝲地址http://www.tkk7.com/liyingcheng/archive/2007/09/26/148317.html飘雪飘雪Wed, 26 Sep 2007 06:07:00 GMThttp://www.tkk7.com/liyingcheng/archive/2007/09/26/148317.htmlhttp://www.tkk7.com/liyingcheng/comments/148317.htmlhttp://www.tkk7.com/liyingcheng/archive/2007/09/26/148317.html#Feedback0http://www.tkk7.com/liyingcheng/comments/commentRss/148317.htmlhttp://www.tkk7.com/liyingcheng/services/trackbacks/148317.html
http://hi.baidu.com/zbzb/blog/item/d71bfcedbd98464d79f055ba.html

jdk1.6帮助文档下蝲地址
http://gceclub.sun.com.cn/Java_Docs/jdk6/JDK_API_1_6_zh_CN.CHM

飘雪 2007-09-26 14:07 发表评论
]]>
eclipse插g安装的两个方?/title><link>http://www.tkk7.com/liyingcheng/archive/2007/08/31/141747.html</link><dc:creator>飘雪</dc:creator><author>飘雪</author><pubDate>Fri, 31 Aug 2007 07:42:00 GMT</pubDate><guid>http://www.tkk7.com/liyingcheng/archive/2007/08/31/141747.html</guid><wfw:comment>http://www.tkk7.com/liyingcheng/comments/141747.html</wfw:comment><comments>http://www.tkk7.com/liyingcheng/archive/2007/08/31/141747.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/liyingcheng/comments/commentRss/141747.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/liyingcheng/services/trackbacks/141747.html</trackback:ping><description><![CDATA[     摘要:   <a href='http://www.tkk7.com/liyingcheng/archive/2007/08/31/141747.html'>阅读全文</a><img src ="http://www.tkk7.com/liyingcheng/aggbug/141747.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/liyingcheng/" target="_blank">飘雪</a> 2007-08-31 15:42 <a href="http://www.tkk7.com/liyingcheng/archive/2007/08/31/141747.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>swt学习Q{Q?/title><link>http://www.tkk7.com/liyingcheng/archive/2007/06/22/125811.html</link><dc:creator>飘雪</dc:creator><author>飘雪</author><pubDate>Fri, 22 Jun 2007 05:00:00 GMT</pubDate><guid>http://www.tkk7.com/liyingcheng/archive/2007/06/22/125811.html</guid><wfw:comment>http://www.tkk7.com/liyingcheng/comments/125811.html</wfw:comment><comments>http://www.tkk7.com/liyingcheng/archive/2007/06/22/125811.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/liyingcheng/comments/commentRss/125811.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/liyingcheng/services/trackbacks/125811.html</trackback:ping><description><![CDATA[     摘要: swt入门介绍  <a href='http://www.tkk7.com/liyingcheng/archive/2007/06/22/125811.html'>阅读全文</a><img src ="http://www.tkk7.com/liyingcheng/aggbug/125811.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/liyingcheng/" target="_blank">飘雪</a> 2007-06-22 13:00 <a href="http://www.tkk7.com/liyingcheng/archive/2007/06/22/125811.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> վ֩ģ壺 <a href="http://hnmxld.com" target="_blank">ƬƵۿ</a>| <a href="http://yeyaweiban.com" target="_blank">һɫþۺ޾Ʒ</a>| <a href="http://www-65jjj.com" target="_blank">ػaaëƬƵ</a>| <a href="http://vinsotec.com" target="_blank">޾Ʒר߲</a>| <a href="http://yuase.com" target="_blank">3344ѲŹۿƵ</a>| <a href="http://qqcnm.com" target="_blank">ɫ͵͵ɫݺ99</a>| <a href="http://maiertejx.com" target="_blank">պVAĻ </a>| <a href="http://2002tw.com" target="_blank">AVҹƷһ</a>| <a href="http://abbobo.com" target="_blank">30Ů˺ѹۿ</a>| <a href="http://wua72.com" target="_blank">avۺպ</a>| <a href="http://kimnote.com" target="_blank">Ʒ޳AV߹ۿ</a>| <a href="http://vv848.com" target="_blank">Ʒ鶹Ѱ</a>| <a href="http://bjtjchem.com" target="_blank">߿Ƭ˳Ӿ</a>| <a href="http://xjywater.com" target="_blank">һ2456б</a>| <a href="http://zxbj0471.com" target="_blank">޹Ʒþ</a>| <a href="http://286513.com" target="_blank">ձ</a>| <a href="http://445645.com" target="_blank">þùֱ</a>| <a href="http://ztxfkj.com" target="_blank">߾þ֮ۺ߾þ</a>| <a href="http://zzhdrsqwx.com" target="_blank">޸XXXXɫ</a>| <a href="http://chn139.com" target="_blank">Ļѵַ߹ۿ</a>| <a href="http://o091i.com" target="_blank">ƷվƵ</a>| <a href="http://bznys.com" target="_blank">һػɫƬ</a>| <a href="http://yanhx.com" target="_blank">7777þĻ</a>| <a href="http://zj1069.com" target="_blank">޾Ʒרþþ</a>| <a href="http://mogo321.com" target="_blank">պɫѹۿ</a>| <a href="http://0102008.com" target="_blank">ִӲˬִֿƵ</a>| <a href="http://arkinbokis.com" target="_blank">ѴƬavֻƬ</a>| <a href="http://tyfinland.com" target="_blank">ASS츾ëPICS</a>| <a href="http://www-9970.com" target="_blank">AV鶹Խ</a>| <a href="http://lyaa60.com" target="_blank">ѹ˸߹ۿ鶹</a>| <a href="http://ymtphoto.com" target="_blank">ŷɫƵ߹ۿ</a>| <a href="http://fense1.com" target="_blank">aaaëƬƵѹۿ</a>| <a href="http://199291.com" target="_blank">ۺ</a>| <a href="http://dsdkg.com" target="_blank">պav</a>| <a href="http://haiwaizhuyun.com" target="_blank">޾Ʒ߹ۿ</a>| <a href="http://74rr.com" target="_blank">޾Ʒ³ĵӰ</a>| <a href="http://www-840012.com" target="_blank">ĻӰѹۿַ</a>| <a href="http://hairdehf.com" target="_blank">99reѾƷƵۿ</a>| <a href="http://91ptv.com" target="_blank">ѵӰվ</a>| <a href="http://wwwly6080.com" target="_blank">ʮ߹ۿӰ</a>| <a href="http://c7vl.com" target="_blank">Ƶ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>