SUMMARY: CONSTR | METHOD DETAIL: CONSTR | METHOD

Class Thread::Apartment::Server

Inherits from:
Thread::Apartment::Common
Exporter

Known Subclasses:
Thread::Apartment::MuxServer
Thread::Apartment::EventServer

Abstract base class for proxied objects. Also acts as a container class for POPO's. Provides introspection methods to collect an object's class hierarchy, public methods and method behavior map, as well as marshalling results of method calls, and creating wrappers for proxied closures.

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_from_hash($tac)
          Used for objects using hash-based constructor parameter lists
new_from_list($tac)
          Used for objects using list-based constructor parameter lists

Method Summary
create_client()
          (class method) Creates a TAC for the object or class; a subclass may override this to provide their own TAC implementation
debug($level)
          Set debug level
evict()
          Pure virtual function called when an object is evicted from a thread
get_client()
          Return the object's TAC
get_no_objects()
          (class method) Virtual function to return a hashref of public method names that are do not return objects
get_simplex_methods()
          (class method) Virtual function to return a hashref of public method names that are simplex
get_urgent_methods()
          (class method) Virtual function to return a hashref of public method names that are urgent
init_tas($tqd, $timeout, $installed)
          (class method) Init class/thread-global variables
install()
          (class method) Pure virtual function called when an object is installed in a thread
introspect($base, $objid, $autoload)
          (class method) Introspects a class or object
marshalResults(@results)
          (class method) Marshalls results from method calls
new_simplex_tacl($closure)
          (class method) Create a Thread::Apartment::Closure object to contain a simplex, non-urgent closure, and map it into the apartment thread's closure map
new_tacl($closure)
          (class method) Create a Thread::Apartment::Closure object to contain a duplex, non-urgent closure, and map it into the apartment thread's closure map
new_urgent_simplex_tacl($closure)
          (class method) Create a Thread::Apartment::Closure object to contain a simplex, urgent closure, and map it into the apartment thread's closure map
new_urgent_tacl($closure)
          (class method) Create a Thread::Apartment::Closure object to contain a duplex, urgent closure, and map it into the apartment thread's closure map
set_client($tac)
          Set the local reference to an object's TAC, so it can be passed to other T::A objects

Constructor Details

new_from_hash

new_from_hash($tac)

Used for objects using hash-based constructor parameter lists.

Parameters:
$tac - TAC for the object
Returns:
Thread::Apartment::Server object

new_from_list

new_from_list($tac)

Used for objects using list-based constructor parameter lists.

Parameters:
$tac - TAC for the object
Returns:
Thread::Apartment::Server object

Method Details

create_client

create_client()

(class method) Creates a TAC for the object or class; a subclass may override this to provide their own TAC implementation

Returns:
Thread::Apartment::Client object

debug

debug($level)

Set debug level.

Parameters:
$level - debug level

evict

evict()

Pure virtual function called when an object is evicted from a thread. Useful for cleaning up any persistent context.


get_client

get_client()

Return the object's TAC.

Returns:
Thread::Apartment::Client for the object

get_no_objects

get_no_objects()

(class method) Virtual function to return a hashref of public method names that are do not return objects. Called during introspection. The returned map is used internally to optimize marshalling of method call results.

Returns:
hashref of public non-object-returning methods

get_simplex_methods

get_simplex_methods()

(class method) Virtual function to return a hashref of public method names that are simplex. (i.e., do not return results, and hence the TAC does not wait for returned results when another T::A object calls the method). Called during introspection.

Returns:
hashref of public simplex methods

get_urgent_methods

get_urgent_methods()

(class method) Virtual function to return a hashref of public method names that are urgent. (i.e., proxied method calls should be placed at the head of the TQD in order to be serviced ASAP). Called during introspection.

Returns:
hashref of public urgent methods

init_tas

init_tas($tqd, $timeout, $installed)

(class method) Init class/thread-global variables

Parameters:
$tqd - apartment's TQD
$timeout - response timeout for TQD
$installed - flag to indicate if the object has been install()'ed, rather than constructed

install

install()

(class method) Pure virtual function called when an object is installed in a thread.


introspect

introspect($base, $objid, $autoload)

(class method) Introspects a class or object. Used to
  1. collect the class/object's class hierarchy for proxied isa() calls
  2. collect a map of public method names to their behavior flags for proxied can() and method calls
  3. establish the object as reentrant, and/or AUTOLOAD-all
  4. create a TAC for the object
  5. create a TACo for installed objects

Parameters:
$base - either a class name, or an object instance
$objid - unique object ID assigned to the object
$autoload - (optional) boolean indicating the object is autoload-all; default false
Returns:
((arrayref if class hierarchy, hashref of public method map, object's TAC) )

marshalResults

marshalResults(@results)

(class method) Marshalls results from method calls. Overrides Thread::Apartment::Common::marshal to trap returned objects for conversion to TACs by adding to, or recovering from, the containing apartment thread's object map.

Parameters:
@results - list of results to be marshalled
Returns:
threads::shared arrayref of marshalled parameters

new_simplex_tacl

new_simplex_tacl($closure)

(class method) Create a Thread::Apartment::Closure object to contain a simplex, non-urgent closure, and map it into the apartment thread's closure map.

Parameters:
$closure - closure to be contained.
Returns:
Thread::Apartment::Closure object

new_tacl

new_tacl($closure)

(class method) Create a Thread::Apartment::Closure object to contain a duplex, non-urgent closure, and map it into the apartment thread's closure map.

Parameters:
$closure - closure to be contained.
Returns:
Thread::Apartment::Closure object

new_urgent_simplex_tacl

new_urgent_simplex_tacl($closure)

(class method) Create a Thread::Apartment::Closure object to contain a simplex, urgent closure, and map it into the apartment thread's closure map.

Parameters:
$closure - closure to be contained.
Returns:
Thread::Apartment::Closure object

new_urgent_tacl

new_urgent_tacl($closure)

(class method) Create a Thread::Apartment::Closure object to contain a duplex, urgent closure, and map it into the apartment thread's closure map.

Parameters:
$closure - closure to be contained.
Returns:
Thread::Apartment::Closure object

set_client

set_client($tac)

Set the local reference to an object's TAC, so it can be passed to other T::A objects. Note that this is usually called from the constructor of TAS implementors.

Parameters:
$tac - Thread::Apartment::Client for the object
Returns:
Thread::Apartment::Server object

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