> From: Peter Royal [mailto:[EMAIL PROTECTED]] 
> 
> On Tuesday 11 June 2002 07:22 am, Leo Sutic wrote:
> > 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 
> > *interfaces*.
> >    even if the implementation does not require an end-of-transaction
> >    signal from the client, the method must be specified so 
> > implementations
> >    that do require such a signal can recieve them."
> >
> > How about that?
> 
> Yes, but not for all components. Only components that are 
> "heavy / scarce" in 
> some respect and need to be pooled.  (JDBC Connection, Cocoon 
> pipeline 
> components..)

OK - I'm fine with that. If it is inherent in a component's interface
that it does not need to be released ever, then - no release() or 
equivalent.

I just do not want to come across a situation where my implementation
of a component interface requires release() and the interface does
not have it. (Thus, the code using the component will never call it.)

For example:

public interface PetersComponent {
  public final static String ROLE = "...";

  public void doStuff ();
}

public class LeosImplementation implements PetersComponent {

  public void doStuff () {
    // ...
  }

  public void release () {
    // Must be called, but how? PetersComponent does not specify it,
    // so users of this interface never calls release() or any
equivalent.
  }
}

But I'm fine with:

/**
 * Proof that implementations of PetersComponentThatNeverNeedsRelease
 * will never need a release() method
 *
 * ...
 *
 * Q.E.D.
 */
public interface PetersComponentThatNeverNeedsRelease {
  public final static String ROLE = "...";

  public void doStuff ();
}

public class LeosImplementation 
  implements PetersComponentThatNeverNeedsRelease {

  public void doStuff () {
    // ...
  }

  // No release() needed.
}

/LS


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to