001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.cache.invalidation;
023:
024: import java.io.Serializable;
025:
026: /**
027: * InvalidationManager (IM) represents locally managed caches and invaliders. To be able
028: * to do distributed invalidations, it is necessary to bridge these IM to forward
029: * cache invalidation messages.
030: * The InvalidationBridgeListener provides the way for any transport mechanism to
031: * be used to forward cache invalidation messages accross a network/cluster.
032: * @see InvalidationManagerMBean
033: * @author <a href="mailto:sacha.labourey@cogito-info.ch">Sacha Labourey</a>.
034: * @version $Revision: 57209 $
035: *
036: * <p><b>Revisions:</b>
037: *
038: * <p><b>24 septembre 2002 Sacha Labourey:</b>
039: * <ul>
040: * <li> First implementation </li>
041: * </ul>
042: */
043:
044: public interface InvalidationBridgeListener {
045: /**
046: * Called when a set of invalidations, concerning more than one IG, should be forwarded
047: * accross the bridge.
048: * It is the bridge responsability to determine:
049: * - which IG must be bridged (some IG may not exist on other nodes, in this case
050: * the bridge may decide to drop these invalidations messages to reduce the
051: * serialization cost and network usage)
052: * - to which other nodes the invalidations must be communicated. This can be done
053: * by any mean (automatic discovery, configuration file, etc.)
054: * @param invalidations BatchInvalidation messages containing invalidations
055: * @param asynchronous Determine the best-effort indication to be used to communicate invalidations
056: */
057: public void batchInvalidate(BatchInvalidation[] invalidations,
058: boolean asynchronous);
059:
060: /**
061: * Called when a single invalidation, concerning a single IG, should be forwarded
062: * accross the bridge.
063: * It is the bridge responsability to determine:
064: * - which IG must be bridged (some IG may not exist on other nodes, in this case
065: * the bridge may decide to drop these invalidations messages to reduce the
066: * serialization cost and network usage)
067: * - to which other nodes the invalidations must be communicated. This can be done
068: * by any mean (automatic discovery, configuration file, etc.)
069: * @param invalidationGroupName InvalidationGroup name
070: * @param key Key to be invalidated
071: * @param asynchronous Best effort communication setting
072: */
073: public void invalidate(String invalidationGroupName,
074: Serializable key, boolean asynchronous);
075:
076: /** Called when a set of invalidations, concerning a single IG, should be forwarded
077: * accross the bridge.
078: * It is the bridge responsability to determine:
079: * - which IG must be bridged (some IG may not exist on other nodes, in this case
080: * the bridge may decide to drop these invalidations messages to reduce the
081: * serialization cost and network usage)
082: * - to which other nodes the invalidations must be communicated. This can be done
083: * by any mean (automatic discovery, configuration file, etc.)
084: * @param invalidationGroupName Name of the InvalidationGroup to which is linked the invalidation message
085: * @param keys Keys to be invalidated
086: * @param asynchronous Best effort communication setting
087: */
088: public void invalidate(String invalidationGroupName,
089: Serializable[] keys, boolean asynchronous);
090:
091: /**
092: * Issues invalidate all event to other nodes.
093: * @param groupName group's name
094: * @param asynchronous mode
095: */
096: public void invalidateAll(String groupName, boolean asynchronous);
097:
098: /**
099: * Called when an InvocationGroup is dropped (because no cache and invalider are
100: * using it anymore).
101: * For bridge implementations that automatically discover which IG should be
102: * bridged, this callback can be used to communicate to the other nodes that this
103: * node is no more interested in invalidation for this group.
104: * @param groupInvalidationName Name of the InvalidationGroup being dropped
105: */
106: public void groupIsDropped(String groupInvalidationName);
107:
108: /**
109: * Called when an InvocationGroup is created.
110: * For bridge implementations that automatically discover which IG should be
111: * bridged, this callback can be used to communicate to the other nodes that this
112: * node is now interested in invalidation for this group.
113: * @param groupInvalidationName Name of the InvalidationGroup just being created
114: */
115: public void newGroupCreated(String groupInvalidationName);
116:
117: }
|