org.rhq.enterprise.server.cloud.instance
Class ServerManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.cloud.instance.ServerManagerBean
All Implemented Interfaces:
ServerManagerLocal

public class ServerManagerBean
extends Object
implements ServerManagerLocal

If you want to manipulate or report on the Server instance that some piece of code is currently executing on, use the ServerManagerBean. This session bean determines the identity of the server it's running on by reading the rhq.server.high-availability.name property from the rhq-server.properties file. The functionality provided here is useful when you need to execute something on every server in the cloud, such as partitioned services and data.

Author:
Joseph Marques

Field Summary
 
Fields inherited from interface org.rhq.enterprise.server.cloud.instance.ServerManagerLocal
MAINTENANCE_MODE_ON_STARTUP_PROPERTY
 
Constructor Summary
ServerManagerBean()
           
 
Method Summary
 void beat()
          Updates server mtime to register active heart beat
 int create(org.rhq.core.domain.cloud.Server server)
          Persist the fully defined .
 void establishCurrentServerMode()
          Checks current server mode against previous serverMode and takes any state change actions necessary.
 List<org.rhq.core.domain.resource.Agent> getAgents()
          At any time an active agent is communicating (either registered with, or connected to) a server in the cloud.
 List<Integer> getAndClearAgentsWithStatus()
          An Agent can have various status settings Agent.
 boolean getAndClearServerStatus()
          A Server can have various status settings Server.
 String getIdentity()
          Determine the identity (i.e.
 org.rhq.core.domain.cloud.Server getServer()
          Returns an object representing this server as it is known within the registered cloud of servers.
 void handleHeartbeatTimer(javax.ejb.Timer timer)
           
 void printWithTrace(String message)
           
 void scheduleServerHeartbeat()
           
 void syncEndpointAddress()
          Synchronizes the endpoint address of this server with the host name or address found on the host machine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerManagerBean

public ServerManagerBean()
Method Detail

scheduleServerHeartbeat

public void scheduleServerHeartbeat()
Specified by:
scheduleServerHeartbeat in interface ServerManagerLocal

handleHeartbeatTimer

public void handleHeartbeatTimer(javax.ejb.Timer timer)
Specified by:
handleHeartbeatTimer in interface ServerManagerLocal

create

public int create(org.rhq.core.domain.cloud.Server server)
Description copied from interface: ServerManagerLocal
Persist the fully defined .

Specified by:
create in interface ServerManagerLocal
Returns:
The internal Id of the new Server

getIdentity

public String getIdentity()
Description copied from interface: ServerManagerLocal
Determine the identity (i.e. Server Name) of this server by inspecting the configures system property. This is the mechanism used for a server to determine which server it is in the registered cloud servers.

Specified by:
getIdentity in interface ServerManagerLocal
Returns:
The server name for this server.

getAgents

public List<org.rhq.core.domain.resource.Agent> getAgents()
Description copied from interface: ServerManagerLocal
At any time an active agent is communicating (either registered with, or connected to) a server in the cloud. Note that an agent that went down unexpectedly may still be referencing a server although it is not actively communicating.

Specified by:
getAgents in interface ServerManagerLocal
Returns:
The list of Agents referencing this server.

getAndClearAgentsWithStatus

public List<Integer> getAndClearAgentsWithStatus()
Description copied from interface: ServerManagerLocal
An Agent can have various status settings Agent. The Status, when set, indicates that this agent has some necessary work pending, typically processed by a periodic job.

Specified by:
getAndClearAgentsWithStatus in interface ServerManagerLocal
Returns:
The subset of agents referencing this server that currently have some Status set.

getAndClearServerStatus

public boolean getAndClearServerStatus()
Description copied from interface: ServerManagerLocal
A Server can have various status settings Server. The Status, when set, indicates that this server has some necessary work pending, typically processed by a periodic job.

Specified by:
getAndClearServerStatus in interface ServerManagerLocal
Returns:
whether or not this server had its Status set.

getServer

public org.rhq.core.domain.cloud.Server getServer()
                                           throws ServerNotFoundException
Description copied from interface: ServerManagerLocal
Returns an object representing this server as it is known within the registered cloud of servers.

Specified by:
getServer in interface ServerManagerLocal
Returns:
object representing this server
Throws:
ServerNotFoundException
See Also:
#getIdentity()}

printWithTrace

public void printWithTrace(String message)

establishCurrentServerMode

public void establishCurrentServerMode()
Description copied from interface: ServerManagerLocal
Checks current server mode against previous serverMode and takes any state change actions necessary. Note that a server can not be DOWN after this call since the call itself is evidence of the server running. So, this can take care of a server starting up.

Specified by:
establishCurrentServerMode in interface ServerManagerLocal

syncEndpointAddress

public void syncEndpointAddress()
                         throws SyncEndpointAddressException
Description copied from interface: ServerManagerLocal
Synchronizes the endpoint address of this server with the host name or address found on the host machine. If the host name or address of this machine differs from Server.getAddress() then this server will be updated with the value of this machine's host name/address.

Specified by:
syncEndpointAddress in interface ServerManagerLocal
Throws:
SyncEndpointAddressException

beat

public void beat()
Description copied from interface: ServerManagerLocal
Updates server mtime to register active heart beat

Specified by:
beat in interface ServerManagerLocal


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.