org.jboss.bootstrap
Class AbstractServerImpl

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.jboss.bootstrap.AbstractServerImpl
All Implemented Interfaces:
NotificationBroadcaster, NotificationEmitter, Server, ServerProcess
Direct Known Subclasses:
ServerImpl

public abstract class AbstractServerImpl
extends NotificationBroadcasterSupport
implements ServerProcess, NotificationEmitter

A Server implementation that uses the deployer-beans.xml and ProfileService to boot the server.

Version:
$Revision: 85188 $
Author:
Scott.Stark@jboss.org, Dimitris.Andreadis@jboss.org, adrian@jboss.org

Field Summary
protected  org.jboss.logging.Logger log
          Instance logger.
 
Fields inherited from interface org.jboss.bootstrap.spi.Server
START_NOTIFICATION_TYPE, STOP_NOTIFICATION_TYPE
 
Constructor Summary
AbstractServerImpl()
          No-arg constructor for ServerImpl
 
Method Summary
 void addBootstrap(Bootstrap bootstrap)
          Add a bootstrap
protected abstract  void doShutdown()
          Override to perform the shutdown
protected abstract  void doStart(org.jboss.util.StopWatch watch)
          Override to perform the start operations
 void exit()
          Exit the JVM with code 1, run shutdown hooks, shutdown the server.
 void exit(int exitcode)
          Exit the JVM, run shutdown hooks, shutdown the server.
 String getBuildDate()
          The server build date
 String getBuildID()
           
 String getBuildJVM()
           
 String getBuildNumber()
           
 String getBuildOS()
           
 ServerConfig getConfig()
          Get the typed server configuration object which the server has been initalized to use.
 Map<String,Object> getMetaData()
          Get the optional server configuration metadata
 Date getStartDate()
           
 String getVersion()
           
 String getVersionName()
           
 String getVersionNumber()
           
 void halt()
          Forcibly terminates the currently running Java virtual machine.
 void halt(int exitcode)
          Forcibly terminates the currently running Java virtual machine.
 void init(Properties props)
          Initialize the server by calling init(props, null);
 void init(Properties props, Map<String,Object> metadata)
          Initialize the Server instance.
 boolean isInShutdown()
          Check if the shutdown operation has been called/is in progress.
 boolean isStarted()
          Check if the server is started.
 void removeBootstrap(Bootstrap bootstrap)
          Remove a bootstrap
 void runFinalization()
          Hint to the JVM to run any pending object finalizations.
 void runGarbageCollector()
          Hint to the JVM to run the garbage collector.
 void setMetaData(Map<String,Object> metadata)
          Set the server configuration metadata
 void shutdown()
          Shutdown the Server instance and run shutdown hooks.
protected  void shutdownServer()
          Shutdown the server
 void start()
          Start the Server instance.
 void traceInstructions(Boolean flag)
          Enable or disable tracing instructions the Runtime level.
 void traceMethodCalls(Boolean flag)
          Enable or disable tracing method calls at the Runtime level.
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.management.NotificationEmitter
removeNotificationListener
 
Methods inherited from interface javax.management.NotificationBroadcaster
addNotificationListener, getNotificationInfo, removeNotificationListener
 

Field Detail

log

protected org.jboss.logging.Logger log
Instance logger.

Constructor Detail

AbstractServerImpl

public AbstractServerImpl()
No-arg constructor for ServerImpl

Method Detail

addBootstrap

public void addBootstrap(Bootstrap bootstrap)
Add a bootstrap

Parameters:
bootstrap - the bootstrap
Throws:
IllegalArgumentException - for a null bootstrap

removeBootstrap

public void removeBootstrap(Bootstrap bootstrap)
Remove a bootstrap

Parameters:
bootstrap - the bootstrap
Throws:
IllegalArgumentException - for a null bootstrap

init

public void init(Properties props)
          throws IllegalStateException,
                 Exception
Initialize the server by calling init(props, null);

Specified by:
init in interface Server
Parameters:
props - The configuration properties for the server.
Throws:
IllegalStateException - Already initialized.
Exception - Failed to initialize.

init

public void init(Properties props,
                 Map<String,Object> metadata)
          throws IllegalStateException,
                 Exception
Initialize the Server instance.

Specified by:
init in interface Server
Parameters:
props - - The configuration properties for the server.
metadata - configuration metadata for the server
Throws:
IllegalStateException - Already initialized.
Exception - Failed to initialize.

getConfig

public ServerConfig getConfig()
                       throws IllegalStateException
Get the typed server configuration object which the server has been initalized to use.

Specified by:
getConfig in interface Server
Returns:
Typed server configuration object.
Throws:
IllegalStateException - Not initialized.

getMetaData

public Map<String,Object> getMetaData()
Get the optional server configuration metadata

Specified by:
getMetaData in interface Server
Returns:
a possibly empty map of configuration metadata.

setMetaData

public void setMetaData(Map<String,Object> metadata)
Set the server configuration metadata

Parameters:
metadata -

isStarted

public boolean isStarted()
Check if the server is started.

Specified by:
isStarted in interface Server
Returns:
True if the server is started, else false.

isInShutdown

public boolean isInShutdown()
Check if the shutdown operation has been called/is in progress.

Specified by:
isInShutdown in interface Server
Returns:
true if shutdown has been called, false otherwise

start

public void start()
           throws IllegalStateException,
                  Exception
Start the Server instance.

Specified by:
start in interface Server
Throws:
IllegalStateException - Already started or not initialized.
Exception - Failed to start.

doStart

protected abstract void doStart(org.jboss.util.StopWatch watch)
                         throws Throwable
Override to perform the start operations

Parameters:
watch - the stop watch
Throws:
Throwable - for any error

doShutdown

protected abstract void doShutdown()
Override to perform the shutdown


shutdownServer

protected void shutdownServer()
Shutdown the server


shutdown

public void shutdown()
              throws IllegalStateException
Shutdown the Server instance and run shutdown hooks.

If the exit on shutdown flag is true, then exit() is called, else only the shutdown hook is run.

Specified by:
shutdown in interface Server
Throws:
IllegalStateException - No started.

exit

public void exit(int exitcode)
Exit the JVM, run shutdown hooks, shutdown the server.

Specified by:
exit in interface ServerProcess
Parameters:
exitcode - The exit code returned to the operating system.

exit

public void exit()
Exit the JVM with code 1, run shutdown hooks, shutdown the server.

Specified by:
exit in interface ServerProcess

halt

public void halt(int exitcode)
Forcibly terminates the currently running Java virtual machine.

Specified by:
halt in interface ServerProcess
Parameters:
exitcode - The exit code returned to the operating system.

halt

public void halt()
Forcibly terminates the currently running Java virtual machine. Halts with code 1.

Specified by:
halt in interface ServerProcess

runGarbageCollector

public void runGarbageCollector()
Hint to the JVM to run the garbage collector.


runFinalization

public void runFinalization()
Hint to the JVM to run any pending object finalizations.


traceMethodCalls

public void traceMethodCalls(Boolean flag)
Enable or disable tracing method calls at the Runtime level.

Parameters:
flag - whether to enable trace

traceInstructions

public void traceInstructions(Boolean flag)
Enable or disable tracing instructions the Runtime level.

Parameters:
flag - whether to enable trace

getStartDate

public Date getStartDate()
Specified by:
getStartDate in interface Server
Returns:
The server start date

getVersion

public String getVersion()
Specified by:
getVersion in interface Server
Returns:
The server version

getVersionName

public String getVersionName()
Specified by:
getVersionName in interface Server
Returns:
The server version code name

getVersionNumber

public String getVersionNumber()
Specified by:
getVersionNumber in interface Server
Returns:
The full server version number

getBuildNumber

public String getBuildNumber()
Specified by:
getBuildNumber in interface Server
Returns:
The date the server was build (compiled)

getBuildJVM

public String getBuildJVM()
Specified by:
getBuildJVM in interface Server
Returns:
The JVM used to build the server

getBuildOS

public String getBuildOS()
Specified by:
getBuildOS in interface Server
Returns:
The Operating System used to build the server

getBuildID

public String getBuildID()
Specified by:
getBuildID in interface Server
Returns:
The build id

getBuildDate

public String getBuildDate()
The server build date

Specified by:
getBuildDate in interface Server
Returns:
server build date


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.