01: /*
02: * Copyright (C) The DNA Group. All rights reserved.
03: *
04: * This software is published under the terms of the DNA
05: * Software License version 1.1, a copy of which has been included
06: * with this distribution in the LICENSE.txt file.
07: */
08: package org.codehaus.dna;
09:
10: /**
11: * Utility class to signal to the container that
12: * a resource is no longer going to be used by
13: * the component.
14: *
15: * @version $Revision: 1.2 $ $Date: 2004/05/01 09:51:48 $
16: */
17: public class ReleaseUtil {
18: /**
19: * Utility interface used to mark resources that
20: * can be released. Developers should never directly
21: * reference this class and never make a component
22: * implement this interface. Instead the container
23: * will choose to have the proxys of component implement
24: * the interface.
25: */
26: public interface Releaseable {
27: /**
28: * Indicate to the container that component no
29: * longer needs resources.
30: */
31: void release();
32: }
33:
34: /**
35: * The component invokes this method to indicate to
36: * the container that it no longer needs specified
37: * resource.
38: *
39: * @param object the resource
40: */
41: public static void release(final Object object) {
42: if (object instanceof Releaseable) {
43: ((Releaseable) object).release();
44: }
45: }
46: }
|