Class LookupManager

java.lang.Object
com.j_spaces.core.LookupManager
All Implemented Interfaces:
EventListener, LeaseListener, ServiceIDListener

public class LookupManager extends Object implements ServiceIDListener, LeaseListener
This class LookupManager provides :
  • Registration forever of JSpaces and JSpace containers with all discovered Lookup Services using registerForever() method.
  • Registering container and JSpaces with rmiregistry.
  • Registering JSpace and JSpace containers with exists ServiceID.
  • LeaseRenewManager that renews each lease as necessary to achieve a desired expiration time.
  • Dynamic registration of all JSpaces and JSpace container with all discovered Lookup Services.
  • Notification of LookupEvents.
  • Clean up LookupManager.
  • Logger messages.
The registerForever() method registering forever(Lease.FOREVER) JSpace with with all Lookup Services that discovered in the Network. The cleanup() method provides unregistration of all spaces that was registered FOREVER from all Lookup Services. LookupManager support container and JSpace registration with Rmi registry depends "com.j_spaces.core.container.use_rmi_registry" property in <container-name>-config.xml file [false] - Do not use rmi registry. [true] - Use rmi registry and Lookup services. When space or container goes down(reboot) all information about container stored in <%GSDir%>\config\<%hostname of container%>.xml file. The information is - Attributes of every space in container. - ServiceID of every space. - All information about every LookupService(ServiceID). - Which spaces registered on every LookupService. Using this information after reboot of computer(LookupService) where spaces was registered, all spaces will be registered with exists ServiceID. This class using LeaseRenewManager class to renews each lease of registered space as necessary when a desired expiration time achieved. Every Lookup Service that was discovered in the Network, dynamically will registered with all spaces that stored in this LookupManager object. Every LookupService that was discovered in the Network will get notification to discovered() method. Whether one or more lookup service registrars has been discarded this class will get notification to discarded method. terminate function unregistering container and JSpaces from all lookup services and terminate LookupManager.//TODO Constructor of this class get as parameter Log object that provides writing all Log-statements that existing in this class to Log(it can be File, Socket). If this Log object equals to null, all Log-statements will be disable.
Version:
1.0
Author:
Igor Goldenberg
  • Constructor Summary

    Constructors
    Constructor
    Description
    LookupManager(String containerName)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static LookupLocator[]
    buildLookupLocators(String lookupLocatorURLs)
    Parse LookupLocator URLs and build array of LookupLocator.
    void
    notify(LeaseRenewalEvent leaseManagerEvent)
    Called by the LeaseRenewalManager when it cannot renew a lease that it is managing, and the lease's desired expiration time has not yet been reached.
    void
    register(IJSpace spaceProxy, String containerName)
    Registering forever proxy of JSpace with all Lookup services that exists in the Network.
    void
    Call back function that receive as parameter the serviceID of registered service.
    void
    Unregister all JSpace and JSpace container from all Lookup Services.
    void
    unregister(String spaceName)
    Unregistering appropriate Space from all Lookup Services that this space was registered.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • serviceIDNotify

      public void serviceIDNotify(ServiceID serviceID)
      Call back function that receive as parameter the serviceID of registered service.
      Specified by:
      serviceIDNotify in interface ServiceIDListener
      Parameters:
      serviceID - ServiceID of registered service.
    • notify

      public void notify(LeaseRenewalEvent leaseManagerEvent)
      Called by the LeaseRenewalManager when it cannot renew a lease that it is managing, and the lease's desired expiration time has not yet been reached.
      Specified by:
      notify in interface LeaseListener
      Parameters:
      leaseManagerEvent - Instance of LeaseRenewalEvent containing information about the lease that the LeaseRenewalManager was unable to renew.
    • buildLookupLocators

      public static LookupLocator[] buildLookupLocators(String lookupLocatorURLs)
      Parse LookupLocator URLs and build array of LookupLocator. List of LookupLocator URLs should be separates by comma. For example: "host1:4180,host2:4180,host3:4180"
      Parameters:
      lookupLocatorURLs - List of LookupLocators URLs, separates by ",".
      Returns:
      LookupLocator[] Array of initialized LookupLocator.
    • register

      public void register(IJSpace spaceProxy, String containerName)
      Registering forever proxy of JSpace with all Lookup services that exists in the Network.
      Parameters:
      spaceProxy - JSpace proxy.
    • unregister

      public void unregister(String spaceName)
      Unregistering appropriate Space from all Lookup Services that this space was registered.
      Parameters:
      spaceName - JSpace name. is not known to the grantor of the lease. This can occur when a lease expires or has been canceled.
    • terminate

      public void terminate() throws RemoteException
      Unregister all JSpace and JSpace container from all Lookup Services.
      Throws:
      RemoteException