001//
002// Name
003//  $RCSfile: PartitionNotifier.java,v $
004// 
005// Copyright
006//  Confidential Property of Kabira Technologies, Inc.
007//  Copyright 2010, 2011 by Kabira Technologies, Inc.
008//  All rights reserved.
009//
010// History
011//  $Revision: 1.1.2.4 $ $Date: 2011/03/04 02:13:13 $
012//
013package com.kabira.platform.highavailability;
014
015import com.kabira.platform.annotation.Managed;
016
017/**
018 * The PartitionNotifier class. This managed class is extended by
019 * applications in order to get notifications of partition state changes.
020 * Note that applications should never define fields in the subclass to
021 * avoid any transaction locks.
022 */
023@Managed
024public abstract class PartitionNotifier
025{
026    /**
027     * Called when a partition state change happens.
028     *
029     * @param partitionName The name of partition that changed. 
030     * @param oldState      The old partition state 
031     * @param newState      The new partition state 
032     * <p>
033     * This operation is called whenever a partition has a change in the
034     * partition State. The notifier is called on all remote nodes where
035     * a notifier instance is defined via {@link Partition#setNotifier}.
036     * <p>
037     * Partition state changes are never lost, and called in the order 
038     * that the state changes occur. Since accessing a Partition instance via
039     * {@link PartitionManager#getPartition} will contain a snapshot of the
040     * partition state, this method passes in the old and new states.
041     */
042        protected abstract void stateChange(
043        String partitionName,
044        Partition.State oldState,
045        Partition.State newState);
046}