01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.oscache.base;
06:
07: /**
08: * Event handlers implement this so they can be notified when a cache
09: * is created and also when it is destroyed. This allows event handlers
10: * to load any configuration and/or resources they need on startup and
11: * then release them again when the cache is shut down.
12: *
13: * @author <a href="mailto:chris@swebtec.com">Chris Miller</a>
14: *
15: * @see com.opensymphony.oscache.base.events.CacheEventListener
16: */
17: public interface LifecycleAware {
18: /**
19: * Called by the cache administrator class when a cache is instantiated.
20: *
21: * @param cache the cache instance that this listener is attached to.
22: * @param config The cache's configuration details. This allows the event handler
23: * to initialize itself based on the cache settings, and also to receive <em>additional</em>
24: * settings that were part of the cache configuration but that the cache
25: * itself does not care about. If you are using <code>cache.properties</code>
26: * for your configuration, simply add any additional properties that your event
27: * handler requires and they will be passed through in this parameter.
28: *
29: * @throws InitializationException thrown when there was a problem initializing the
30: * listener. The cache administrator will log this error and disable the listener.
31: */
32: public void initialize(Cache cache, Config config)
33: throws InitializationException;
34:
35: /**
36: * Called by the cache administrator class when a cache is destroyed.
37: *
38: * @throws FinalizationException thrown when there was a problem finalizing the
39: * listener. The cache administrator will catch and log this error.
40: */
41: public void finialize() throws FinalizationException;
42: }
|