1. /*
  2. * @(#)IIOPPrimaryToContactInfo.java 1.4 04/07/26
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.spi.transport;
  8. import java.util.List;
  9. import com.sun.corba.se.pept.transport.ContactInfo;
  10. /**
  11. * This interface is the "sticky manager" for IIOP failover. The default
  12. * ORB does NOT contain a sticky manager. One is registered by supplying
  13. * a class via the com.sun.CORBA.transport.ORBIIOPPrimaryToContactInfoClass.
  14. *
  15. * It uses the IIOP primary host/port (with a SocketInfo.IIOP_CLEAR_TEXT type)
  16. * as a key to map to the last ContactInfo that resulted in successful'
  17. * communication.
  18. *
  19. * It mainly prevents "fallback" - if a previously failed replica comes
  20. * back up we do NOT want to switch back to using it - particularly in the
  21. * case of statefull session beans.
  22. *
  23. * Note: This assumes static lists of replicas (e.g., AS 8.1 EE).
  24. * This does NOT work well with LOCATION_FORWARD.
  25. *
  26. * @author Harold Carr
  27. */
  28. public interface IIOPPrimaryToContactInfo
  29. {
  30. /**
  31. * @param primary - clear any state relating to primary.
  32. */
  33. public void reset(ContactInfo primary);
  34. /**
  35. * @param primary - the key.
  36. * @param previous - if null return true. Otherwise, find previous in
  37. * <code>contactInfos</code> and if another <code>ContactInfo</code>
  38. * follows it in the list then return true. Otherwise false.
  39. * @param contactInfos - the list of replicas associated with the
  40. * primary.
  41. */
  42. public boolean hasNext(ContactInfo primary,
  43. ContactInfo previous,
  44. List contactInfos);
  45. /**
  46. * @param primary - the key.
  47. * @param previous - if null then map primary to failover. If failover is
  48. * empty then map primary to primary and return primary. If failover is
  49. * non-empty then return failover. If previous is non-null that
  50. * indicates that the previous failed. Therefore, find previous in
  51. * contactInfos. Map the <code>ContactInfo</code> following
  52. * previous to primary and return that <code>ContactInfo</code>.
  53. */
  54. public ContactInfo next(ContactInfo primary,
  55. ContactInfo previous,
  56. List contactInfos);
  57. }
  58. // End of file.