NAME

App::ResourceLocker - Interface for locking shared resources

SYNOPSIS

use App;

$context = App->context();
$srs = $context->service("ResourceLocker");  # or ...
$srs = $context->shared_resource_set();

DESCRIPTION

A ResourceLocker service represents a collection of "advisory" (or "cooperative") resource locks.

Class Group: ResourceLocker

The following classes might be a part of the ResourceLocker Class Group.

  • Class: App::ResourceLocker

  • Class: App::ResourceLocker::IPCLocker

  • Class: App::ResourceLocker::IPCSemaphore

  • Class: App::ResourceLocker::BerkeleyDB

Class: App::ResourceLocker

A ResourceLocker service represents a collection of "advisory" (or "cooperative") resource locks. These can be used to synchronize access to and modification of shared resources such as are stored in a SharedDatastore.

* Throws: App::Exception::ResourceLocker
* Since:  0.01

Constructor Methods:

new()

The constructor is inherited from App::Service.

Public Methods:

lock()

* Signature: $resource_name = $srs->lock($resource_pool);
* Signature: $resource_name = $srs->lock($named);
* Param:     $resource_pool          string
* Param:     resourcePool            string
* Param:     nonBlocking             boolean
* Param:     nonExclusive            boolean
* Param:     maxWaitTimeMS           integer
* Return:    $resource_name          string
* Throws:    App::Exception::ResourceLocker
* Since:     0.01

Sample Usage: 

$context = App->context();
$srs = $context->service("ResourceLocker");
$srs->lock("shmem01");

The lock() method on a ResourceLocker is for the purposes of cooperative resource locking.

unlock()

* Signature: $srs->unlock($resource_name);
* Param:     $resource_name          string
* Return:    void
* Throws:    App::Exception::ResourceLocker
* Since:     0.01

Sample Usage: 

$context = App->context();
$srs = $context->service("ResourceLocker");
$srs->unlock("shmem01");

Protected Methods:

service_type()

Returns 'ResourceLocker';

* Signature: $service_type = App::ResourceLocker->service_type();
* Param:     void
* Return:    $service_type  string
* Since:     0.01

$service_type = $rlock->service_type();

ACKNOWLEDGEMENTS

* Author:  Stephen Adkins <spadkins@gmail.com>
* License: This is free software. It is licensed under the same terms as Perl itself.

SEE ALSO

App::Context, App::Service