|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
LifecycleAware.java | - | - | - | - |
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2003 by OpenSymphony
|
|
3 |
* All rights reserved.
|
|
4 |
*/
|
|
5 |
package com.opensymphony.oscache.base;
|
|
6 |
|
|
7 |
|
|
8 |
/**
|
|
9 |
* Event handlers implement this so they can be notified when a cache
|
|
10 |
* is created and also when it is destroyed. This allows event handlers
|
|
11 |
* to load any configuration and/or resources they need on startup and
|
|
12 |
* then release them again when the cache is shut down.
|
|
13 |
*
|
|
14 |
* @author <a href="mailto:chris@swebtec.com">Chris Miller</a>
|
|
15 |
*
|
|
16 |
* @see com.opensymphony.oscache.base.events.CacheEventListener
|
|
17 |
*/
|
|
18 |
public interface LifecycleAware { |
|
19 |
/**
|
|
20 |
* Called by the cache administrator class when a cache is instantiated.
|
|
21 |
*
|
|
22 |
* @param cache the cache instance that this listener is attached to.
|
|
23 |
* @param config The cache's configuration details. This allows the event handler
|
|
24 |
* to initialize itself based on the cache settings, and also to receive <em>additional</em>
|
|
25 |
* settings that were part of the cache configuration but that the cache
|
|
26 |
* itself does not care about. If you are using <code>cache.properties</code>
|
|
27 |
* for your configuration, simply add any additional properties that your event
|
|
28 |
* handler requires and they will be passed through in this parameter.
|
|
29 |
*
|
|
30 |
* @throws InitializationException thrown when there was a problem initializing the
|
|
31 |
* listener. The cache administrator will log this error and disable the listener.
|
|
32 |
*/
|
|
33 |
public void initialize(Cache cache, Config config) 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 |
} |
|
43 |
|
|