org.jacorb.imr

Class ImRServerInfo

public class ImRServerInfo extends Object implements Serializable

This class contains the information about a logical server. It has methods for managing the associated POAs, holding and releasing the server, and, for the "client side", a method that blocks until the server is released.

Version: $Id: ImRServerInfo.java,v 1.14 2006/07/14 11:41:38 alphonse.bendt Exp $

Author: Nicolas Noffke

Field Summary
protected booleanactive
protected Stringcommand
protected booleanholding
protected Stringhost
protected Stringname
protected booleanrestarting
static longserialVersionUID
Constructor Summary
ImRServerInfo(String name, String host, String command)
The Constructor.
Method Summary
voidaddPOA(ImRPOAInfo poa)
Adds a POA to this server.
voidawaitRelease()
This method blocks until the server is released, i.e. set to not holding.
protected String[]getPOANames()
Builds an array of of the names of the POAs associated with this server.
voidrelease()
Release the server and unblock all waiting threads.
voidsetDown()
Sets the server down, i.e. not active.
voidsetNotRestarting()
booleanshouldBeRestarted()
Tests if this server should be restarted.
ServerInfotoServerInfo()
"Converts" this Object to a ServerInfo instance containing the same info as this object.

Field Detail

active

protected boolean active

command

protected String command

holding

protected boolean holding

host

protected String host

name

protected String name

restarting

protected boolean restarting

serialVersionUID

public static final long serialVersionUID

Constructor Detail

ImRServerInfo

public ImRServerInfo(String name, String host, String command)
The Constructor. It sets up the internal attributes.

Parameters: name the logical server name host the name of the host on which the server should be restarted (ignored when no startup command is specified). command the startup command for this server, passed to the server startup daemon on host (in case there is one active).

Throws: IllegalServerName thrown when name is null or of length zero.

Method Detail

addPOA

public void addPOA(ImRPOAInfo poa)
Adds a POA to this server.

Parameters: poa the POA to add.

awaitRelease

public void awaitRelease()
This method blocks until the server is released, i.e. set to not holding.
This will not time out since holding a server is only done by administrators.

getPOANames

protected String[] getPOANames()
Builds an array of of the names of the POAs associated with this server.
This method is needed for deleting a server since its POAs have to be as well removed from the central storage.

Returns: an array of POA names

release

public void release()
Release the server and unblock all waiting threads.

setDown

public void setDown()
Sets the server down, i.e. not active. If a request for a POA of this server is received, the repository tries to restart the server.
The server is automatically set back to active when the first of its POAs gets reregistered.

setNotRestarting

public void setNotRestarting()

shouldBeRestarted

public boolean shouldBeRestarted()
Tests if this server should be restarted. That is the case if the server is not active and nobody else is currently trying to restart it.
If true is returned the server is set to restarting. That means the thread calling this method has to restart the server, otherwise it will stay down indefinetly.

Returns: true, if the server should be restarted by the calling thread.

toServerInfo

public ServerInfo toServerInfo()
"Converts" this Object to a ServerInfo instance containing the same info as this object.

Returns: a ServerInfo object.