<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>孙立文的博客 &#187; Java</title>
	<atom:link href="http://sunliwen.com/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://sunliwen.com</link>
	<description>Never lose my passion!</description>
	<lastBuildDate>Sat, 21 Jan 2012 05:16:52 +0000</lastBuildDate>
	<language>zh</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>A Conversation with Anders Hejlsberg, by Bill Venners with Bruce Eckel(August 4, 2003)</title>
		<link>http://sunliwen.com/2009/01/conversation-with-anders/</link>
		<comments>http://sunliwen.com/2009/01/conversation-with-anders/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 09:01:44 +0000</pubDate>
		<dc:creator>Liwen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://thinklouder.cn/?p=790</guid>
		<description><![CDATA[A Conversation with Anders Hejlsberg, by Bill Venners with Bruce Eckel August 4, 2003 These conversation includes 8 parts: In Part I: The C# Design Process, Hejlsberg discusses the process used by the team that designed C#, and the relative merits of usability studies and good taste in language design. In Part II: The Trouble [...]]]></description>
			<content:encoded><![CDATA[<p>
A Conversation with Anders Hejlsberg,<br />
by Bill Venners with Bruce Eckel<br />
August 4, 2003</p>
<p>These conversation includes 8 parts:</p>
<ul>
<li>In <a href="http://www.artima.com/intv/csdes.html">Part I: The C# Design Process</a>, Hejlsberg discusses the process used by the team that designed C#, and the relative merits of usability studies and good taste in language design.</li>
<li>In <a href="http://www.artima.com/intv/wp-admin/handcuffs.html">Part II: The Trouble with Checked Exceptions</a>, Hejlsberg discusses versionability and scalability issues with checked exceptions.</li>
<li>In <a href="http://www.artima.com/intv/simplexity.html">Part III: Delegates, Components, and Simplexity</a>, Hejlsberg discusses delegates and C#&#8217;s first class treatment of component concepts.</li>
<li>In <a href="http://www.artima.com/intv/nonvirtual.html">Part IV: Versioning, Virtual, and Override</a>, Hejlsberg explains why C# instance methods are non-virtual by default and why programmers must explicitly indicate an override.</li>
<li>In <a href="http://www.artima.com/intv/interop.html">Part V: Contracts and Interoperability</a>, Hejlsberg discusses DLL hell and interface contracts, strong names, and the importance of interoperability.</li>
<li>In <a href="http://www.artima.com/intv/abstract.html">Part VI: Inappropriate Abstractions</a>, Hejlsberg and other members of the C# team discuss the trouble with distributed systems infrastructures that attempt to make the network transparent, and object-relational mappings that attempt to make the database invisible.</li>
<li>In <a href="http://www.artima.com/intv/generics.html">Part VII: Generics in C#, Java, and C++</a>, Hejlsberg compares C#&#8217;s generics implementation to Java generics and C++ templates, describes constraints in C# generics, and describes typing as a dial.</li>
<li>In <a href="http://www.artima.com/intv/choicesP.html">Part VIII: CLR Design Choices</a>, Hejlsberg discusses IL instructions, non-virtual methods, unsafe code, value types, and immutables.
</li>
</ul>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="ckepop">
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_douban"></a>
	<a class="jiathis_button_instapaper"></a>
	<a class="jiathis_button_stubleupon"></a>
	<a href="http://www.jiathis.com/share?uid=1544311" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript">var jiathis_config = {data_track_clickback:true};</script>
<script type="text/javascript" src="http://v2.jiathis.com/code_mini/jia.js?uid=1544311" charset="utf-8"></script>
<!-- JiaThis Button END --></div><hr />
<p>
<small>
Tags: <a href="http://sunliwen.com/tag/dotnet/" rel="tag">.NET</a>, <a href="http://sunliwen.com/tag/java/" rel="tag">Java</a><br/>
<a href="http://sunliwen.com/2009/01/conversation-with-anders/#comments-heading">没有评论</a>
</small>
</p>]]></content:encoded>
			<wfw:commentRss>http://sunliwen.com/2009/01/conversation-with-anders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java程序向.NET移植过程中的笔记</title>
		<link>http://sunliwen.com/2008/11/migrating-java-application-to-dotnet/</link>
		<comments>http://sunliwen.com/2008/11/migrating-java-application-to-dotnet/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 10:28:07 +0000</pubDate>
		<dc:creator>Liwen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.thinklouder.cn/?p=23</guid>
		<description><![CDATA[移植TE过程中遇到了一些Java与.NET平台的差异而产生的问题，在此记录。.NET中一些“隐藏功能”在这个过程中得到了很好的应用。 这里采用手工移植的方式，也可以尝试JLCA等自动转换工具。参见MSDN Magazine上的介绍JLCA使用案例的文章。 有关Java与.Net异同的一篇采访，A Conversation with Anders Hejlsberg(C#设计者) by Bill Venners with Bruce Eckel(Thinking in Java作者)。 final vs virtual Java中除静态函数以外的方法默认都是虚函数，都可以被覆写，需要使用final关键字标记使其不能被覆写。但也有更准确的解释。 C#中必须用virtual关键字显式的声明一个方法可被覆写。第一个原因是性能，更重要的原因是版本。更具体的解释且看Anders Hejlsberg,Bruce Eckel等人的谈话。 final vs sealed Java中可以使用final关键字标记类，使其不能被继承。 而.Net中使用sealed。对于类也可以用static关键字（会被自动编译为sealed）来防止被派生。 public class Test &#123; Integer testField; &#160; Integer methodA&#40;&#41; &#123; return testField; &#125; &#160; final Integer methodB&#40;&#41; &#123; return testField; &#125; &#125; &#160; class Test1 extends Test [...]]]></description>
			<content:encoded><![CDATA[<p>移植TE过程中遇到了一些Java与.NET平台的差异而产生的问题，在此记录。.NET中一些“<a href="http://stackoverflow.com/questions/9033/hidden-features-of-c">隐藏功能</a>”在这个过程中得到了很好的应用。<br />
这里采用手工移植的方式，也可以尝试<a href="http://msdn.microsoft.com/en-us/aa718346.aspx">JLCA</a>等自动转换工具。参见MSDN Magazine上的介绍<a href="http://msdn.microsoft.com/en-us/magazine/cc163422.aspx">JLCA使用案例</a>的文章。</p>
<p>有关Java与.Net异同的一篇采访，<a href="http://www.artima.com/intv/anders.html">A Conversation with Anders Hejlsberg</a>(C#设计者) by Bill Venners with Bruce Eckel(Thinking in Java作者)。</p>
<h4>final vs virtual</h4>
<p>Java中除静态函数以外的方法默认都是虚函数，都可以被覆写，需要使用<a href="http://en.wikipedia.org/wiki/Final_(Java)">final</a>关键字标记使其不能被覆写。但也有更准确的<a href="http://blog.csdn.net/nomad2/archive/2006/05/11/723443.aspx">解释</a>。<br />
C#中必须用<a href="http://msdn.microsoft.com/en-us/library/9fkccyh4(VS.80).aspx">virtual</a>关键字显式的声明一个方法可被覆写。第一个原因是性能，更重要的原因是版本。更具体的解释且看Anders Hejlsberg,Bruce Eckel等人的<a href="http://www.artima.com/intv/nonvirtualP.html">谈话</a>。</p>
<h4>final <a href="http://stackoverflow.com/questions/154698?sort=newest">vs</a> sealed</h4>
<p>Java中可以使用final关键字标记类，使其不能被继承。<br />
而.Net中使用<a href="http://msdn.microsoft.com/en-us/library/88c54tsw.aspx">sealed</a>。对于类也可以用static关键字（会被自动编译为sealed）来防止被派生。</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Test <span style="color: #009900;">&#123;</span>
  <span style="color: #003399;">Integer</span> testField<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #003399;">Integer</span> methodA<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> testField<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">Integer</span> methodB<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> testField<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Test1 <span style="color: #000000; font-weight: bold;">extends</span> Test <span style="color: #009900;">&#123;</span>
  @Override
  <span style="color: #003399;">Integer</span> methodA<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  @Override              <span style="color: #666666; font-style: italic;">// error, it can not be overrided</span>
  <span style="color: #003399;">Integer</span> methodB<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h4>Descriptor</h4>
<p>Java中的<a href="http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html%231169">Descriptor</a>可以用字符串的形式描述字段和方法的类型。但在.Net中我没有类似的东西（如果有请告知）。通过反射查看.Net Assembly可以看到的方法完整的信息，例如变量、参数等。只是没有一个类似Java Descriptor的东西。囧</p>
<h4>多线程(Multiple Thread)</h4>
<p>Java中需要实现Java.Lang.Runnable接口<br />
.Net多线程只需要将一个方法赋给ThreadStart这个代理然后传给Thread并且调用Thread.Start()方法。<br />
相对而言后者有更好的同步或者异步的支持。.Net多线程有一个不错的<a href="http://www.yoda.arachsys.com/csharp/threads/index.shtml">在线教程</a>。</p>
<h4>Exception</h4>
<p>InvalidOperationException == IllegalStateException</p>
<h4>implicit &amp; explicit</h4>
<p>implicit是一个关键字，实现隐式转换</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">namespace</span> implicitExample
<span style="color: #008000;">&#123;</span>
    <span style="color: #6666cc; font-weight: bold;">class</span> Digit
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> Digit<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">double</span> d<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> val <span style="color: #008000;">=</span> d<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">double</span> val<span style="color: #008000;">;</span>
        <span style="color: #008080; font-style: italic;">// ...other members</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">// User-defined conversion from Digit to double</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">implicit</span> <span style="color: #0600FF; font-weight: bold;">operator</span> <span style="color: #6666cc; font-weight: bold;">double</span><span style="color: #008000;">&#40;</span>Digit d<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> d<span style="color: #008000;">.</span><span style="color: #0000FF;">val</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080; font-style: italic;">//  User-defined conversion from double to Digit</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">implicit</span> <span style="color: #0600FF; font-weight: bold;">operator</span> Digit<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">double</span> d<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">new</span> Digit<span style="color: #008000;">&#40;</span>d<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
    <span style="color: #6666cc; font-weight: bold;">class</span> Program
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> args<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            Digit dig <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Digit<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">7</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008080; font-style: italic;">//This call invokes the implicit &quot;double&quot; operator</span>
            <span style="color: #6666cc; font-weight: bold;">double</span> num <span style="color: #008000;">=</span> dig<span style="color: #008000;">;</span>
            <span style="color: #008080; font-style: italic;">//This call invokes the implicit &quot;Digit&quot; operator</span>
            Digit dig2 <span style="color: #008000;">=</span> <span style="color: #FF0000;">12</span><span style="color: #008000;">;</span>
            Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;num = {0} dig2 = {1}&quot;</span>, num, dig2<span style="color: #008000;">.</span><span style="color: #0000FF;">val</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            Console<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadLine</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<h4>泛型，泛型集合(Generic &amp; Generic Collection)</h4>
<p>Java的<a href="http://www.eclipse.org/aspectj/doc/released/adk15notebook/generics.html">泛型</a>，在处理泛型集合时会遇到可写不可写的情况，参看这个<a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=24&amp;t=043884">讨论</a>。</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">List<span style="color: #339933;">&lt;?&gt;</span>    <span style="color: #666666; font-style: italic;">// 类型未知，只能添加null</span>
List<span style="color: #339933;">&lt;?</span> <span style="color: #000000; font-weight: bold;">extends</span> Number<span style="color: #339933;">&gt;</span>    <span style="color: #666666; font-style: italic;">// 类型未知，限定为Number的派生类，只能添加null</span>
List<span style="color: #339933;">&lt;?</span> <span style="color: #000000; font-weight: bold;">super</span> Double<span style="color: #339933;">&gt;</span>    <span style="color: #666666; font-style: italic;">// 类型位置，限定为Double的基类，可以添加元素</span></pre></div></div>

<p>方形方法的例子</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">void</span> recordNonOveridableMethodCall<span style="color: #009900;">&#40;</span>Reason reason, <span style="color: #000066; font-weight: bold;">int</span> lineNumber,
     MethodInfo toMethod, Variable methodThis,
     <span style="color: #003399;">List</span> parameters, Variable returnVariable<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">//...</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>.NET的<a href="http://msdn.microsoft.com/en-us/library/ms172192.aspx">泛型</a></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">void</span> recordNonOveridableMethodCall<span style="color: #008000;">&#40;</span>Reason reason, <span style="color: #6666cc; font-weight: bold;">int</span> lineNumber,
     MethodInfo toMethod, Variable methodThis,
     List parameters, Variable returnVariable<span style="color: #008000;">&#41;</span> <span style="color: #0600FF; font-weight: bold;">where</span> T <span style="color: #008000;">:</span> Variable<span style="color: #008000;">&#123;</span>
     <span style="color: #008080; font-style: italic;">//...</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<h4>嵌套类(Nested Class in Java, Inner Class in .Net)</h4>
<p>.Net中嵌套类与Java中的有很大不同，内部类只能访问到外部类的静态字段、属性和方法。<br />
而Java中则都可以访问。</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">class</span> OuterClass
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">int</span> outerStaticField<span style="color: #008000;">;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">int</span> outerField<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #6666cc; font-weight: bold;">class</span> InnerClass
    <span style="color: #008000;">&#123;</span>
        InnerClass<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            outerStaticField <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
            <span style="color: #008080; font-style: italic;">//outerField = 1; // compile time error</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<h4>TreeSet</h4>
<p>java.util.TreeSet之类的集合在.NET Framework中没有找到对应的实现，<a href="http://www.itu.dk/research/c5/">C5</a>这个项目提供了大量的数据结构实现。需要调研并加以采用。目前用到了TreeSet这个<a href="http://en.wikipedia.org/wiki/Red-black_tree">红白树</a>(Red-Black tree)实现。</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="ckepop">
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_douban"></a>
	<a class="jiathis_button_instapaper"></a>
	<a class="jiathis_button_stubleupon"></a>
	<a href="http://www.jiathis.com/share?uid=1544311" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript">var jiathis_config = {data_track_clickback:true};</script>
<script type="text/javascript" src="http://v2.jiathis.com/code_mini/jia.js?uid=1544311" charset="utf-8"></script>
<!-- JiaThis Button END --></div><hr />
<p>
<small>
Tags: <a href="http://sunliwen.com/tag/dotnet/" rel="tag">.NET</a>, <a href="http://sunliwen.com/tag/java/" rel="tag">Java</a><br/>
<a href="http://sunliwen.com/2008/11/migrating-java-application-to-dotnet/#comments-heading">没有评论</a>
</small>
</p>]]></content:encoded>
			<wfw:commentRss>http://sunliwen.com/2008/11/migrating-java-application-to-dotnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>关于RMI的理解</title>
		<link>http://sunliwen.com/2006/01/%e5%85%b3%e4%ba%8ermi%e7%9a%84%e7%90%86%e8%a7%a3/</link>
		<comments>http://sunliwen.com/2006/01/%e5%85%b3%e4%ba%8ermi%e7%9a%84%e7%90%86%e8%a7%a3/#comments</comments>
		<pubDate>Wed, 18 Jan 2006 16:54:59 +0000</pubDate>
		<dc:creator>Liwen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://fishpot.spaces.live.com/Blog/cns!AA7DB611C0406AB4!280.entry</guid>
		<description><![CDATA[RMI在EJB中又占有很重要得成份。不过完全没有必要因此而挡住了学习上前进的道路。 一RMI:指Remote Method Invocation （远程方法调用）。 说到远程方法调用，就应该说一下计算机通信技术。 计算机通信技术到目前为止主要有3种： 1.Socket 2.RPC 3.RMI Socket在Java基础中已经学习，但是那只是皮毛而已。Socket得深入学习要对计算机通信底层技术非常熟悉，才会将Socket得代码写的非常好。否则Socket会让你痛不欲生。 RPC和RMI差不多，主要都是屏蔽了底层得具体实现。而者区别主要在于： RPC是远程过程调用。 RMI是远程方法调用。 二RMI实现过程。 简言之，RMI机制在实现过程中，会产生2个对象，分别是：Stub和Skeleton。 Stub在客户端，Skeleton在服务器端。Stub做为远程对象在客户端得代理，客户端在调用远程对象得过程，其实是调用Stub对象中相应得方法。随后Stub调用远程对象中相应得方法。 Skeleton会根据Stub传过来得信息进行解码，然后调用对应得方法。在方法调用完成后，会返回给Stub一个处理结果。Stub在将处理结果返回给调用他的客户端。 这样RMI就完成了基本得调用循环。  Tags: Java 没有评论]]></description>
			<content:encoded><![CDATA[<p>RMI在EJB中又占有很重要得成份。不过完全没有必要因此而挡住了学习上前进的道路。</p>
<p>一<br />RMI:指Remote Method Invocation （远程方法调用）。</p>
<p>说到远程方法调用，就应该说一下计算机通信技术。</p>
<p>计算机通信技术到目前为止主要有3种：</p>
<p>1.Socket 2.RPC 3.RMI</p>
<p>Socket在Java基础中已经学习，但是那只是皮毛而已。Socket得深入学习要对计算机通信底层技术非常熟悉，才会将Socket得代码写的非常好。否则Socket会让你痛不欲生。</p>
<p>RPC和RMI差不多，主要都是屏蔽了底层得具体实现。而者区别主要在于：</p>
<p>RPC是远程过程调用。</p>
<p>RMI是远程方法调用。</p>
<p>二<br />RMI实现过程。</p>
<p>简言之，RMI机制在实现过程中，会产生2个对象，分别是：Stub和Skeleton。</p>
<p>Stub在客户端，Skeleton在服务器端。Stub做为远程对象在客户端得代理，客户端在调用远程对象得过程，其实是调用Stub对象中相应得方法。随后Stub调用远程对象中相应得方法。</p>
<p>Skeleton会根据Stub传过来得信息进行解码，然后调用对应得方法。在方法调用完成后，会返回给Stub一个处理结果。Stub在将处理结果返回给调用他的客户端。</p>
<p>这样RMI就完成了基本得调用循环。<br /> <br /><img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6161568527816824140&#038;page=RSS%3a+%e5%85%b3%e4%ba%8eRMI%e7%9a%84%e7%90%86%e8%a7%a3&#038;referrer=" width="1px" height="1px" border="0" alt=""><img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;NA=1149&amp;PI=73329&amp;RF=&amp;DI=3919&amp;PS=85545&amp;TP=fishpot.spaces.live.com&amp;GT1=fishpot"></p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="ckepop">
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_douban"></a>
	<a class="jiathis_button_instapaper"></a>
	<a class="jiathis_button_stubleupon"></a>
	<a href="http://www.jiathis.com/share?uid=1544311" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript">var jiathis_config = {data_track_clickback:true};</script>
<script type="text/javascript" src="http://v2.jiathis.com/code_mini/jia.js?uid=1544311" charset="utf-8"></script>
<!-- JiaThis Button END --></div><hr />
<p>
<small>
Tags: <a href="http://sunliwen.com/tag/java/" rel="tag">Java</a><br/>
<a href="http://sunliwen.com/2006/01/%e5%85%b3%e4%ba%8ermi%e7%9a%84%e7%90%86%e8%a7%a3/#comments-heading">没有评论</a>
</small>
</p>]]></content:encoded>
			<wfw:commentRss>http://sunliwen.com/2006/01/%e5%85%b3%e4%ba%8ermi%e7%9a%84%e7%90%86%e8%a7%a3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>9月14日-2005 JavaChina第二天</title>
		<link>http://sunliwen.com/2005/09/javachina-2005-day2/</link>
		<comments>http://sunliwen.com/2005/09/javachina-2005-day2/#comments</comments>
		<pubDate>Wed, 14 Sep 2005 17:28:27 +0000</pubDate>
		<dc:creator>Liwen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[活动]]></category>

		<guid isPermaLink="false">http://fishpot.spaces.live.com/Blog/cns!AA7DB611C0406AB4!181.entry</guid>
		<description><![CDATA[今天是第二天，上午主要想听那位Java之父的演讲，相见识见识。他是不是昨晚没睡好，说话有点结巴。以前没听过他演讲不了解了。一般&#8230; 中国是的生日蛋糕&#8230;做秀&#8230;真假~ 下午坐班车到了京广中心，发现以前来过这里，同一间厅里IBM的活动。 下午第一场 J2EE Cluster ，基本照着这篇文章讲得。感叹这些外国公司把国内牛人都收到麾下了~ HA的标准 98% 每年当机7.3天 99.9999% 每年当机5.25分钟 如果不出意外FTP也算是HA了&#8230; 后面有一场 EJB 3.0 Intro。这场Craig说了几句话就交给一位王某讲了，讲得也不错。比EJB2.1编写起来，简化了很多。但据Craig说只是在编程方式上简化，底层实现还是和原来一样。人们问问题，会有礼品发。 JavaEE 性能调优 是个MM讲得，讲的也不错。是用Java Studio里的一个叫做profiler的工具。好像是这么个名字。看了几次演示，我觉着这个工具还是很好用的&#8230; 这个MM叫做舒畅 说真的那个String的操作竟然用了1秒时间，Java的速度&#8230; 又轮到Craig上场了，主要是因为这个老头我才去京广中心会场的。他和一个有着浓郁印度口音的家伙一起讲。那位印度口音的家伙也讲得也不错，因为说得比较慢，很多人都没带耳机，听起来挺有意思。他做了个几乎没怎么编码的Java EE的Demo。越看越像ASP.NET&#8230; 关于Ajax至少在ASP.NET2.0里已经挺好的支持了Ajax，但是在当前的JSF里还是没有针对Ajax的空间。 JSF里的DataTable和ASP.NET里的DataGrid的如出一辙。估计原理也差不多。 早晨坐车到公主坟地铁到安定门打车到奥体，共15块钱。 晚上从京广中心坐730到玉泉营986到学校共4块。730那车跑得路线真是奇怪。我他妈又转像了。 今天的反馈调查我做的很愉快，因为觉着今天下午的Speech都非常精彩，听者也都积极参与问了几个比较好的问题。我也想了个问题关于页面viewstate和postback我真是想知道这个和ASP.NET有啥区别。不过没问&#8230;从来都这样。 推同传耳机，组织方竟然现金不够&#8230; 不过那几个小伙子处理的挺好&#8230; 我也没发生气&#8230; 大部分与会者应该是Developer竟然有两个MM，一个穿透明吊带，另一个估计得有176。哈哈！盯着看了半天。谁让你满场子都是男的。  ============== 补充 JSF现在有 几个项目在和Ajax融合 Tags: Java, 活动 没有评论]]></description>
			<content:encoded><![CDATA[<div>今天是第二天，上午主要想听那位Java之父的演讲，相见识见识。他是不是昨晚没睡好，说话有点结巴。以前没听过他演讲不了解了。一般&#8230; 中国是的生日蛋糕&#8230;做秀&#8230;真假~</div>
<div>下午坐班车到了京广中心，发现以前来过这里，同一间厅里IBM的活动。</div>
<div>下午第一场 <a href="http://www.theserverside.com/articles/article.tss?l=J2EEClustering">J2EE Cluster</a> ，基本照着这篇文章讲得。感叹这些外国公司把国内牛人都收到麾下了~</div>
<div>HA的标准</div>
<div>98% 每年当机7.3天</div>
<div>99.9999% 每年当机5.25分钟</div>
<div>如果不出意外FTP也算是HA了&#8230;</div>
<div>后面有一场 EJB 3.0 Intro。这场Craig说了几句话就交给一位王某讲了，讲得也不错。比EJB2.1编写起来，简化了很多。但据Craig说只是在编程方式上简化，底层实现还是和原来一样。人们问问题，会有礼品发。</div>
<div>JavaEE 性能调优 是个MM讲得，讲的也不错。是用Java Studio里的一个叫做profiler的工具。好像是这么个名字。看了几次演示，我觉着这个工具还是很好用的&#8230; 这个MM叫做舒畅</div>
<div>说真的那个String的操作竟然用了1秒时间，Java的速度&#8230;</div>
<div>又轮到Craig上场了，主要是因为这个老头我才去京广中心会场的。他和一个有着浓郁印度口音的家伙一起讲。那位印度口音的家伙也讲得也不错，因为说得比较慢，很多人都没带耳机，听起来挺有意思。他做了个几乎没怎么编码的Java EE的Demo。越看越像ASP.NET&#8230;</div>
<div>关于Ajax至少在ASP.NET2.0里已经挺好的支持了Ajax，但是在当前的JSF里还是没有针对Ajax的空间。</div>
<div>JSF里的DataTable和ASP.NET里的DataGrid的如出一辙。估计原理也差不多。</div>
<div>早晨坐车到公主坟地铁到安定门打车到奥体，共15块钱。</div>
<div>晚上从京广中心坐730到玉泉营986到学校共4块。730那车跑得路线真是奇怪。我他妈又转像了。</div>
<div>今天的反馈调查我做的很愉快，因为觉着今天下午的Speech都非常精彩，听者也都积极参与问了几个比较好的问题。我也想了个问题关于页面viewstate和postback我真是想知道这个和ASP.NET有啥区别。不过没问&#8230;从来都这样。</div>
<div>推同传耳机，组织方竟然现金不够&#8230; 不过那几个小伙子处理的挺好&#8230; 我也没发生气&#8230; 大部分与会者应该是Developer竟然有两个MM，一个穿透明吊带，另一个估计得有176。哈哈！盯着看了半天。谁让你满场子都是男的。</div>
<div> ==============</div>
<div>补充</div>
<div>JSF现在有 几个项目在和Ajax融合</div>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="ckepop">
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_douban"></a>
	<a class="jiathis_button_instapaper"></a>
	<a class="jiathis_button_stubleupon"></a>
	<a href="http://www.jiathis.com/share?uid=1544311" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript">var jiathis_config = {data_track_clickback:true};</script>
<script type="text/javascript" src="http://v2.jiathis.com/code_mini/jia.js?uid=1544311" charset="utf-8"></script>
<!-- JiaThis Button END --></div><hr />
<p>
<small>
Tags: <a href="http://sunliwen.com/tag/java/" rel="tag">Java</a>, <a href="http://sunliwen.com/tag/activities/" rel="tag">活动</a><br/>
<a href="http://sunliwen.com/2005/09/javachina-2005-day2/#comments-heading">没有评论</a>
</small>
</p>]]></content:encoded>
			<wfw:commentRss>http://sunliwen.com/2005/09/javachina-2005-day2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

