<?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>暫停 &#8211; 記下來</title>
	<atom:link href="https://noter.tw/tag/%E6%9A%AB%E5%81%9C/feed/" rel="self" type="application/rss+xml" />
	<link>https://noter.tw</link>
	<description>一路上踩到的坑、遇到的問題，一點一滴記下來，希望能幫助到需要的人~</description>
	<lastBuildDate>Tue, 02 Jul 2019 05:53:17 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.3</generator>

<image>
	<url>https://noter.tw/wp-content/uploads/cropped-old-1130742_1920-1-32x32.jpg</url>
	<title>暫停 &#8211; 記下來</title>
	<link>https://noter.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>讓Java程式暫停</title>
		<link>https://noter.tw/2491/%e8%ae%93java%e7%a8%8b%e5%bc%8f%e6%9a%ab%e5%81%9c/</link>
					<comments>https://noter.tw/2491/%e8%ae%93java%e7%a8%8b%e5%bc%8f%e6%9a%ab%e5%81%9c/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Fri, 18 Sep 2009 07:52:05 +0000</pubDate>
				<category><![CDATA[一般程式]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[sleep]]></category>
		<category><![CDATA[Thread]]></category>
		<category><![CDATA[暫停]]></category>
		<guid isPermaLink="false">http://wazai.net/?p=2491</guid>

					<description><![CDATA[<p>有時候某些情況要讓運行中的 Java 程式暫停一下，例如：Crawler某些網頁的時候，太頻繁的抓取可能會造成被網站管理員ban掉，這時候就可以讓 Cralwer 抓取完後暫停一段時間再繼續抓取。 J&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/2491/%e8%ae%93java%e7%a8%8b%e5%bc%8f%e6%9a%ab%e5%81%9c/" data-wpel-link="internal">讓Java程式暫停</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>有時候某些情況要讓運行中的 Java 程式暫停一下，例如：Crawler某些網頁的時候，太頻繁的抓取可能會造成被網站管理員ban掉，這時候就可以讓 Cralwer 抓取完後暫停一段時間再繼續抓取。<br />
<span id="more-2491"></span><br />
Java 程式中的主程式其實也是一個 thread (main thread)，因此看到以下的程式碼就也不覺得奇怪了。</p>
<pre class="brush: java; gutter: true">try {
    Thread.sleep(1000);
} catch(InterruptedException ex) {
}</pre>
<p class="brush: java; gutter: true">sleep 裡面的 1000 是毫秒，也就是停留 1 秒鐘的意思。</p>
<p class="brush: java; gutter: true">
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/2491/%e8%ae%93java%e7%a8%8b%e5%bc%8f%e6%9a%ab%e5%81%9c/" data-wpel-link="internal">讓Java程式暫停</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/2491/%e8%ae%93java%e7%a8%8b%e5%bc%8f%e6%9a%ab%e5%81%9c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
