SUMMARY: CONSTR | METHOD DETAIL: CONSTR | METHOD

Class Thread::Apartment::Client

Inherits from:
Thread::Queue::TQDContainer
Thread::Apartment::Common
Thread::Queue::Queueable

Client proxy for apartment threaded objects.

Licensed under the Academic Free License version 2.1, as specified in the License.txt file included in this software package, or at OpenSource.org.

Author:
D. Arnold
Version:
0.50
Since:
2005-12-01

Unless otherwise noted, $self is the object instance variable.

Constructor Summary
new($proxied_class, $tqd, $id, $isa, $methods, $timeout, $tid)
          Creates a threads::shared hash to contain the proxy information, so it can be readily passed between threads

Method Summary
can($method)
          Overload UNIVERSAL::can() to test the available methods of the proxied object
get_pending_results()
          Return results of a pending method/closure request
get_proxied_class()
          Return proxied class
get_timeout()
          Return current TQD timeout
isa($class)
          Overload UNIVERSAL::isa() to test the class hierarchy of the proxied object
join()
          Wait for the proxied object's apartment thread to exit
redeem($class, $obj)
          TQQ redeem() override
set_async($async)
          Set async method for next call in current thread
set_timeout($timeout)
          Set TQD timeout
stop()
          Stop the proxied object's apartment thread
ta_is_simplex($method)
          Test if the specified method is exported as simplex
ta_is_urgent($method)
          Test if the specified method is exported as urgent
tac_debug($level)
          Set debug level

Constructor Details

new

new($proxied_class, $tqd, $id, $isa, $methods, $timeout, $tid)

Creates a threads::shared hash to contain the proxy information, so it can be readily passed between threads.

Parameters:
$proxied_class - the class of the object to be proxied
$tqd - TQD communications channel to proxied object
$id - unique object ID for proxied object
$isa - arrayref of object's class hierarchy
$methods - hashref mapping exported method names to behavior flags
$timeout - TQD timeout seconds
$tid - thread ID of the apartment thread for the proxied object
Returns:
Thread::Apartment::Client object

Method Details

can

can($method)

Overload UNIVERSAL::can() to test the available methods of the proxied object.

Parameters:
$method - method to check if implemented by the proxied object
Returns:
if the proxied object exports $method (or exports AUTOLOAD), a closure forcing an AUTOLOAD of the specified $method; undef otherwise

get_pending_results

get_pending_results()

Return results of a pending method/closure request. Looks up the pending request ID in the current thread's T::A, then waits for the completion of the request, unmarshals and returns the results.

Returns:
results of the currently pending request (if any)

get_proxied_class

get_proxied_class()

Return proxied class

Returns:
proxied class name string

get_timeout

get_timeout()

Return current TQD timeout

Returns:
TQD timeout in seconds

isa

isa($class)

Overload UNIVERSAL::isa() to test the class hierarchy of the proxied object.

Parameters:
$class - class to check if implemented by the proxied object
Returns:
1 if the proxied object implements $class; undef otherwise

join

join()

Wait for the proxied object's apartment thread to exit.

Returns:
1

redeem

redeem($class, $obj)

TQQ redeem() override. Checks if the TAC has been passed into the thread in which is was created, in which case it looks up and returns the proxied object in the T::A object map. Otherwise, just blesses the object back into a TAC.

Parameters:
$class - our TAC class
$obj - the object to be redeem()ed
Returns:
if in the originating thread, the proxied object; else a reblessed TAC.

set_async

set_async($async)

Set async method for next call in current thread.

Parameters:
$async - boolean value to set $async_method flag
Returns:
none

set_timeout

set_timeout($timeout)

Set TQD timeout

Parameters:
$timeout - max. number of seconds to wait for TQD responses.
Returns:
previous timeout value

stop

stop()

Stop the proxied object's apartment thread.


ta_is_simplex

ta_is_simplex($method)

Test if the specified method is exported as simplex

Parameters:
$method - method to test for simplex behavior
Returns:
1 if $method is exported and is simplex; undef otherwise

ta_is_urgent

ta_is_urgent($method)

Test if the specified method is exported as urgent

Parameters:
$method - method to test for urgent behavior
Returns:
1 if $method is exported and is urgent; undef otherwise

tac_debug

tac_debug($level)

Set debug level. When set to a "true" value, causes the TAC to emit diagnostic information.

Parameters:
$level - debug level. zero or undef turns off debugging; all other values enable debugging
Returns:
the new level

Generated by psichedoc on Mon Mar 27 08:51:36 2006