<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.1" -->
<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/"
	>

<channel>
	<title>Pluit Solutions</title>
	<link>http://www.pluitsolutions.com</link>
	<description>Web Development and Design, and Anything That Matters</description>
	<pubDate>Thu, 15 May 2008 03:20:50 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.1</generator>
	<language>en</language>
			<item>
		<title>Ruby Common Object Pool (common-pool)</title>
		<link>http://www.pluitsolutions.com/projects/common-pool/</link>
		<comments>http://www.pluitsolutions.com/projects/common-pool/#comments</comments>
		<pubDate>Wed, 16 May 2007 03:50:26 +0000</pubDate>
		<dc:creator>Herryanto Siatono</dc:creator>
		
	<category>General</category>
		<guid isPermaLink="false">http://www.pluitsolutions.com/169/</guid>
		<description><![CDATA[What is common-pool?
Ruby version of first-in-first-out (FIFO) object pooling library that checks for invalid and expired idle objects, inspired by Apache Commons Pool.
It supports the following configuration parameters:

min_idle
max_idle
max_idle_time
max_active
timeout
validation_timeout
idle_check_no_per_run
idle_check_interval

Overwrite CommonPool::DataSource to create object to be returned to the pool. For more information, please refer to the Rdoc documentation.
Links

Rubyforge Home
Rdoc Documentation
Tracker
Download

Installation
$ gem install common-pool
Example
require 'common_pool'   [...]]]></description>
			<content:encoded><![CDATA[<h4>What is common-pool?</h4>
<p>Ruby version of first-in-first-out (FIFO) object pooling library that checks for invalid and expired idle objects, inspired by <a href="http://jakarta.apache.org/commons/pool/">Apache Commons Pool</a>.</p>
<p>It supports the following configuration parameters:</p>
<ul>
<li>min_idle</li>
<li>max_idle</li>
<li>max_idle_time</li>
<li>max_active</li>
<li>timeout</li>
<li>validation_timeout</li>
<li>idle_check_no_per_run</li>
<li>idle_check_interval</li>
</ul>
<p>Overwrite <code>CommonPool::DataSource</code> to create object to be returned to the pool. For more information, please refer to the <a href="http://common-pool.rubyforge.org/doc">Rdoc documentation</a>.</p>
<h4>Links</h4>
<ul>
<li><a href="http://rubyforge.org/projects/common-pool/">Rubyforge Home</a></li>
<li><a href="http://common-pool.rubyforge.org/doc">Rdoc Documentation</a></li>
<li><a href="http://rubyforge.org/tracker/?group_id=2674">Tracker</a></li>
<li><a href="http://rubyforge.org/frs/?group_id=2674">Download</a></li>
</ul>
<h4>Installation</h4>
<p><pre>$ gem install common-pool</pre></p>
<h4>Example</h4>
<p><pre>require 'common_pool'    
  
# Extend data source object
class RandomNumberDataSource &lt; CommonPool::PoolDataSource
  # Overwrite to return object to be stored in the pool.
  def create_object
    rand(1000)
  end
    
  # Overwrite to check if idle object in the pool is still valid.
  def valid?(object)
    true
  end
end
  
# Create a new object pool
object_pool = ObjectPool.new(RandomNumberDataSource.new)
  
# Borrow object from the pool
object = object_pool.borrow_object

# Return object to the pool
object_pool.return_object(object)
  
# Or invalidate object and remove it from the pool
object_pool.invalidate_object(object)
  
# Create object pool with idle objects eviction thread
object_pool = ObjectPool.new(RandomNumberDataSource.new) do |config|
  config.min_idle = 5
  config.max_idle = 10
  
  # max 10 idle objects checked per run
  config.idle_check_no_per_run = 10

  # check idle objects every 10 minutes
  config.idle_check_interval = 10 * 60
end

# Return a hash of pool instance status variables, i.e.
# active and idle lists size, and configuration options
object_pool.status_info
</pre></p>
]]></content:encoded>
			<wfw:commentRSS>http://www.pluitsolutions.com/projects/common-pool/feed/</wfw:commentRSS>
		</item>
	</channel>
</rss>
