org.jacorb.imr

Class ImRServerInfo

Implemented Interfaces:
java.io.Serializable

public class ImRServerInfo
extends java.lang.Object
implements java.io.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.11 2004/05/06 12:39:59 nicolas Exp $

Author:
Nicolas Noffke

See Also:
Serialized Form

Field Summary

protected boolean
active
protected String
command
protected boolean
holding
protected String
host
protected String
name
protected boolean
restarting

Constructor Summary

ImRServerInfo(String name, String host, String command)
The Constructor.

Method Summary

void
addPOA(ImRPOAInfo poa)
Adds a POA to this server.
void
awaitRelease()
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.
void
release()
Release the server and unblock all waiting threads.
void
setDown()
Sets the server down, i.e. not active.
void
setNotRestarting()
boolean
shouldBeRestarted()
Tests if this server should be restarted.
ServerInfo
toServerInfo()
"Converts" this Object to a ServerInfo instance containing the same info as this object.

Field Details

active

protected boolean active


command

protected String command


holding

protected boolean holding


host

protected String host


name

protected String name


restarting

protected boolean restarting

Constructor Details

ImRServerInfo

public ImRServerInfo(String name,
                     String host,
                     String command)
            throws IllegalServerName
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 Details

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.