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.
1.
Steve.
/LS
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
|---------------------------------------| | Magic by Merlin | | Production by Avalon | | | | http://avalon.apache.org | |---------------------------------------|
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
