avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <leo.su...@inspireinfrastructure.com>
Subject Semantic Lawyering: Validity of Component Artifacts
Date Tue, 20 Apr 2004 14:08:48 GMT
In the situation where one retrieves some kind of artifact from a 
component, what is the validity of that artifact?

For example:

    public interface Worker {
        public void work();
    }

    public interface WorkerManager {

        public static final String ROLE = ...;
        
        // Never returns null, never fails.
        public Worker getWorker ();
    }

Case 1: This should work.

    WorkerManager wm = null;
    try {
        wm = (WorkerManager) 
            manager.lookup (WorkerManager.ROLE);

        Worker w = wm.getWorker ();

        w.work();
    } finally {
        manager.release (wm);
    }

Case 2: Should this work?

    WorkerManager wm = null;
    Worker w = null;
    try {
        wm = (WorkerManager) 
            manager.lookup (WorkerManager.ROLE);

        w = wm.getWorker ();
    } finally {
        manager.release (wm);
    }

    w.work(); // Use of artifact after having released
              // source component.

So is the validity:

 1. Guaranteed while the source component is unreleased?

 2. Guaranteed for ever?

 3. Not guaranteed at all?

 4. See component docs.

/LS


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


Mime
View raw message