avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <leo.su...@inspireinfrastructure.com>
Subject RE: [proposal] avalon 5 ComponentManager interface
Date Tue, 11 Jun 2002 11:22:28 GMT

> From: Peter Donald [mailto:peter@apache.org] 
> Same way as you deal with all resources. ie call close(), 
> release() etc. 

So can I assume that every component, or every XXXXManager 
has a close() or release() method?

Is this how you intend it to work:

 * The ConnectionManager does not define
 * a release() method, as you call close()
 * on the connection instead.
interface ConnectionManager {
  public static final String ROLE = "...";

  Connection getConnection ();

interface Connection {
  void doSomething ();
  void close ();

 * The OtherManager *must* define a release() method,
 * as the Other interface provides no way for the client to
 * indicate that it is finished using the Other instance.
interface OtherManager {
  public static final String ROLE = "...";

  Other getInstance ();
  void release (Other other);

 * This interface does not specify any way for the client to
 * indicate that the instance can be put back into a pool.
interface Other {
   * May be called any number of times in a transaction.
  void doSomething();

class MyComposer implements Composable {

  private ConnectionManager connectionManager;
  private OtherManager otherManager;

  public void compose(ComponentManager manager) {
    connectionManager = (ConnectionManager) manager.lookup
    otherManager = (OtherManager) manager.lookup (OtherManager.ROLE);  

  public void doWork () {
    Connection conn = null;
    Other other = null;
    try {
      conn = connectionManager.getConnection ();
      other = otherManager.getInstance ();

      conn.doSomething ();
      other.doSomething ();
    } catch (Exception e) {
    } finally {
      if (conn != null) conn.close ();
      otherManager.release (other);

Basically, the contract is:

  "Every pair of component C and its associated CManager interfaces
   must define a method that, when called by the client, indicates 
   that the client is finished using the component C. The method 
   may be in the CManager interface - for example, 
   CManager.release (C c) - or in the C interface - for example, 
   C.close (). Note that this contract applies to component
   even if the implementation does not require an end-of-transaction
   signal from the client, the method must be specified so
   that do require such a signal can recieve them."

How about that?

> The Connector API aims to standardize heavy 
> resource management in J2EE 
> land and JDBC will implement it in the future (unless JDK1.4 
> version does?) 
> and most vendors will use that API.

And what does that have to do with this? The Connector API is about
connecting different systems, not about the presense of a way to 
explicitly release resources. I do note, however, that many interfaces
specify a close() method or other way of releasing resources.


To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

View raw message