KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > invalidation > InvalidationManagerMBean


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.cache.invalidation;
23
24 import org.jboss.system.ServiceMBean;
25 import java.util.Collection JavaDoc;
26
27 /** Main service dealing with cache invalidation. While more than one instance may
28  * be running at the same time, most of the time, only one will be used.
29  * Each InvalidationManager (IM) gives access to a set of InvalidationGroup (IG).
30  * Each IG concerns a particular cache and links subscribers that listen for cache
31  * invalidations messages with cache invaliders that will create invalidation
32  * messages.
33  * Thus, to start, a given service will first ask for a specific IG to work with. This
34  * is an in-VM operation: each cache and invalider works with a *locally* bound IM. If
35  * you want to extend the in-VM mode of operation, you need to provide (possibly
36  * dynamically), your IM-Bridge. A bridge forwards cache-invalidation messages on other
37  * nodes. It may select which IG are bridged. More than one cache can be bound to a
38  * given IM.
39  *
40  * As some applications needs to be able to send in batch invalidation messages that concern
41  * more than one cache. To satisfy this need, a global batchInvalidate method is available
42  * at the IM level.
43  * @see org.jboss.cache.invalidation.InvalidationManager
44  * @author <a HREF="mailto:sacha.labourey@cogito-info.ch">Sacha Labourey</a>.
45  * @version $Revision: 37459 $
46  *
47  * <p><b>Revisions:</b>
48  *
49  * <p><b>21 septembre 2002 Sacha Labourey:</b>
50  * <ul>
51  * <li> First implementation </li>
52  * </ul>
53  */

54
55 public interface InvalidationManagerMBean extends ServiceMBean
56 {
57    /**
58     * Get the is default asynchronous replication mode flag
59     * @return
60     */

61    public boolean getIsAsynchByDefault();
62    /**
63     * Set the is default asynchronous replication mode flag
64     * @param flag - true for asynch by default
65     */

66    public void setIsAsynchByDefault(boolean flag);
67    
68    /**
69     * Returns a given InvalidationGroup instance that is associated with the group name.
70     * All caches that will share the same cache invalidation messages must share the
71     * same group name => the group name (or the IG) represents the identifier of
72     * a set of caches and invaliders.
73     * NOTE: InvalidationGroup.addReference is automatically called when calling this method
74     * Thus, there is no need to call it again on the IG. Nevertheless,
75     * you are still responsible for calling removeReference to GC IG.
76     * @param groupName Name of the group (of the cache for example).
77     * @return The InvalidationGroup associated to the group name i.e. the identifier of the set
78     */

79    public InvalidationGroup getInvalidationGroup (String JavaDoc groupName);
80    
81    /**
82     * Return the set of all InvalidationGroup currently managed by this IM
83     * @return A collection of InvalidationGroup instances
84     */

85    public Collection JavaDoc getInvalidationGroups ();
86    
87    /**
88     * Allow the subscription of a given Bridge to this IM
89     * @param listener The Bridge registring for invalidation messages
90     * @return A BridgeInvalidationSubscription instance that can is used by the bridge
91     * to communicate with the local IM.
92     * @see BridgeInvalidationSubscription
93     */

94    public BridgeInvalidationSubscription registerBridgeListener (InvalidationBridgeListener listener);
95    
96    /**
97     * Invalidate a set of IG managed by this IM. This can be used as an optimisation
98     * if a bridge will forward requests accross a cluster. In this case, a single message
99     * containing all invocations is send accross the wire (it only costs a single network
100     * latency). The IM will manage the dispatching of the invalidation messages to the
101     * Bridges and to the concerned InvalidationGroups.
102     * @param invalidations A set of BatchcInvalidations. Each BatchInvalidation instance contains invalidations
103     * for a given InvalidationGroup.
104     */

105    
106    public void batchInvalidate (BatchInvalidation[] invalidations);
107    
108    /**
109     * Identical as previous method. In this case though, it is override the default
110     * "asynchronous" tag of each InvalidationGroup and explicitly state if the invalidation
111     * messages should be, if possible, be done asynchronously (if implemented by the
112     * bridges for example).
113     * @param invalidations Invalidation messages
114     * @param asynchronous Indicates if the briges should try to do asynchronous invalidations (accross the
115     * network for example) or if a synchronous behaviour is required.
116     */

117    public void batchInvalidate (BatchInvalidation[] invalidations, boolean asynchronous);
118
119    /**
120     * Invalidate all entries for the specified group name.
121     * @param groupName invalidation group name
122     */

123    public void invalidateAll(String JavaDoc groupName);
124
125    /**
126     * Invalidate all entries for the specified group name using the specified mode.
127     * @param groupName invalidate group name
128     * @param async mode
129     */

130    public void invalidateAll(String JavaDoc groupName, boolean async);
131 }
132
Popular Tags