jgroup.relacs.config
Class Host

java.lang.Object
  extended by jgroup.relacs.types.EndPointImpl
      extended by jgroup.relacs.config.Host
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Comparable, java.lang.Iterable<AppConfig>, EndPoint

public class Host
extends EndPointImpl
implements java.lang.Iterable<AppConfig>

The Host class contains information about a single host in a domain.

Since:
Jgroup 1.2
Author:
Alberto Montresor, Hein Meling
See Also:
Serialized Form

Nested Class Summary
static class Host.ReplicaState
          Replica state constants
 
Field Summary
 
Fields inherited from class jgroup.relacs.types.EndPointImpl
address, local, port, SIZE
 
Constructor Summary
Host()
          Default constructor for externalization
Host(java.lang.String hostName, Domain domain, int port)
          Construct a new Host object containing information about the domain, the host and the port number for an entry in the HostSet.
 
Method Summary
 void assign(AppConfig app)
          Assign the app replica to this host.
 boolean contains(AppConfig app)
           
 boolean createReplica(AppConfig app)
          Create a replica for the given app on this host.
 java.lang.Object get(java.lang.String key)
          Retrieve the value associated with this host for the given key.
 java.lang.String getCanonicalHostName()
          Returns the fully qualified domain name (host name and domain name) for this Host object.
 java.util.Map<java.lang.String,java.lang.Object> getContentMap()
           
 Domain getDomain()
          Returns the Domain object associated with this Host object.
 java.lang.String getDomainName()
          Returns the domain name for this Host object, excluding the host name component.
 java.lang.String getHostName()
          Returns the host name for this Host object, excluding the domain name component.
 Host.ReplicaState getState(AppConfig app)
          Returns the current replica state of the given application on this host.
 boolean isAvailable()
          Returns true if the host is available; otherwise false.
 boolean isJoining(AppConfig app)
          Returns true if the given application is currently joining at this host.
 java.util.Iterator<AppConfig> iterator()
           
 java.rmi.Remote lookup(java.lang.String name)
           
 boolean ping()
          Returns true if this host responded to a ping invocation of its ExecService.
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          Associate the given value with this host under the given key.
 java.util.Set<ClassData> queryReplicas()
          Return the set of replicas running on this host as reported by the ExecDaemon.
 void remove(AppConfig app)
           
 boolean removeReplica(AppConfig app)
          Remove the replica for app running on host.
 int replicaCount()
           
 void setContentMap(java.util.Map<java.lang.String,java.lang.Object> c)
           
 void shutdown(int delay)
          Request the execution service on this host to shutdown.
 void suspect()
          Convenience method to update this hosts reachability status.
 void viewChange(AppConfig app)
          Mark the given application as in the normal state.
 
Methods inherited from class jgroup.relacs.types.EndPointImpl
compareTo, equals, getAddress, getIntAddress, getPort, hashCode, isLocal, isMulticastEndPoint, readExternal, toString, writeExternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Host

public Host()
Default constructor for externalization


Host

public Host(java.lang.String hostName,
            Domain domain,
            int port)
     throws java.net.UnknownHostException
Construct a new Host object containing information about the domain, the host and the port number for an entry in the HostSet.

Throws:
java.net.UnknownHostException
Method Detail

getCanonicalHostName

public java.lang.String getCanonicalHostName()
Returns the fully qualified domain name (host name and domain name) for this Host object.


getHostName

public java.lang.String getHostName()
Returns the host name for this Host object, excluding the domain name component.


getDomainName

public java.lang.String getDomainName()
Returns the domain name for this Host object, excluding the host name component.


getDomain

public Domain getDomain()
Returns the Domain object associated with this Host object.


iterator

public java.util.Iterator<AppConfig> iterator()
Specified by:
iterator in interface java.lang.Iterable<AppConfig>

contains

public boolean contains(AppConfig app)

replicaCount

public int replicaCount()

assign

public void assign(AppConfig app)
Assign the app replica to this host.

Parameters:
app -

remove

public void remove(AppConfig app)

get

public java.lang.Object get(java.lang.String key)
Retrieve the value associated with this host for the given key.


put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
Associate the given value with this host under the given key.


getContentMap

public java.util.Map<java.lang.String,java.lang.Object> getContentMap()

setContentMap

public void setContentMap(java.util.Map<java.lang.String,java.lang.Object> c)

isAvailable

public boolean isAvailable()
Returns true if the host is available; otherwise false. The method will also update the reachability status of the host.


suspect

public void suspect()
Convenience method to update this hosts reachability status.


ping

public boolean ping()
Returns true if this host responded to a ping invocation of its ExecService. False is returned otherwise.


lookup

public java.rmi.Remote lookup(java.lang.String name)
                       throws java.rmi.AccessException,
                              java.net.UnknownHostException,
                              java.rmi.RemoteException,
                              java.rmi.NotBoundException
Throws:
java.rmi.AccessException
java.net.UnknownHostException
java.rmi.RemoteException
java.rmi.NotBoundException

createReplica

public boolean createReplica(AppConfig app)
Create a replica for the given app on this host.

Parameters:
app - The app for which to create a replica.
Returns:
True if the creation was executed without any problems; false otherwise.

removeReplica

public boolean removeReplica(AppConfig app)
Remove the replica for app running on host.

Parameters:
app - The app whose replica to remove.
host - The host from which to remove the given replica.
Returns:
True if the removal was executed without any problems; false otherwise.

queryReplicas

public java.util.Set<ClassData> queryReplicas()
Return the set of replicas running on this host as reported by the ExecDaemon.


isJoining

public boolean isJoining(AppConfig app)
Returns true if the given application is currently joining at this host.


getState

public Host.ReplicaState getState(AppConfig app)
Returns the current replica state of the given application on this host.


viewChange

public void viewChange(AppConfig app)
Mark the given application as in the normal state.


shutdown

public void shutdown(int delay)
Request the execution service on this host to shutdown.



Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.