class Async::Pool::Resource

The basic interface required by a pool resource.

def self.call

Constructs a resource.
def self.call
	self.new
end

def close

Close the resource explicitly, e.g. the pool is being closed.
def close
	@closed = true
end

def closed?

Returns:
  • (Boolean) - whether the resource has been closed or has failed.
def closed?
	@closed
end

def initialize(concurrency = 1)

@parameter concurrency [Integer] The concurrency of this resource.

Create a new resource.
def initialize(concurrency = 1)
	@concurrency = concurrency
	@closed = false
	@count = 0
end

def reusable?

Whether this resource can be reused. Used when releasing resources back into the pool.
def reusable?
	!@closed
end

def viable?

Returns:
  • (Boolean) - whether the resource can actually be used.
def viable?
	!@closed
end