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.ha.framework.interfaces;
023:
024: import java.util.ArrayList;
025:
026: /**
027: * Maintain information for a given proxy family. Proxies can statically reference
028: * objects implementing this interface: only the content will change as the
029: * cluster topology changes, not the FamilyClusterInfo object itself.
030: * Proxies or LoadBalancing policy implementations can use the cursor and object
031: * attribute to store arbitrary data that is then shared accross all proxies belonging
032: * to the same family.
033: * Initial access to this object is done through the ClusteringTargetsRepository singleton.
034: *
035: * @see org.jboss.ha.framework.interfaces.FamilyClusterInfoImpl
036: * @see org.jboss.ha.framework.interfaces.ClusteringTargetsRepository
037: *
038: * @author <a href="mailto:sacha.labourey@cogito-info.ch">Sacha Labourey</a>.
039: * @version $Revision: 57188 $
040: *
041: * <p><b>Revisions:</b>
042: *
043: * <p><b>2002/08/23, Sacha Labourey:</b>
044: * <ul>
045: * <li> First implementation </li>
046: * </ul>
047: */
048:
049: public interface FamilyClusterInfo {
050: public String getFamilyName();
051:
052: /**
053: * Gets the list of targets for this family.
054: *
055: * <strong>NOTE:</strong> Implementations should synchronize on themselves
056: * when executing this method (see JBAS-2071).
057: */
058: public ArrayList getTargets();
059:
060: public long getCurrentViewId();
061:
062: /**
063: * Remove the given target from the list of targets.
064: *
065: * <strong>NOTE:</strong> Implementations should synchronize on themselves
066: * when executing this method (see JBAS-2071).
067: *
068: * @param target the target
069: * @return the updated list of targets
070: */
071: public ArrayList removeDeadTarget(Object target);
072:
073: /**
074: * Updates the targets and the view id.
075: *
076: * <strong>NOTE:</strong> Implementations should synchronize on themselves
077: * when executing this method (see JBAS-2071).
078: */
079: public ArrayList updateClusterInfo(ArrayList targets, long viewId);
080:
081: public boolean currentMembershipInSyncWithViewId();
082:
083: /**
084: * Force a reload of the view at the next invocation.
085: *
086: * <strong>NOTE:</strong> Implementations should synchronize on themselves
087: * when executing this method (see JBAS-2071).
088: */
089: public void resetView();
090:
091: // arbitrary usage by the LoadBalancePolicy implementation
092: // We could have used an HashMap but the lookup would have taken
093: // much more time and we probably don't need as much flexibility
094: // (+ it is slow for a simple int)
095: //
096: public int getCursor();
097:
098: public int setCursor(int cursor);
099:
100: public Object getObject();
101:
102: public Object setObject(Object whatever);
103:
104: public final static int UNINITIALIZED_CURSOR = 999999999;
105: }
|