The main container component of a JBoss server instance.
thread-safe.
| Method from org.jboss.system.server.ServerImpl Detail: |
public void addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback) {
broadcasterSupport.addNotificationListener(listener, filter, handback);
}
|
public void exit() {
exit(1);
}
Shutdown the server, the JVM and run shutdown hooks. Exits with
code 1. |
public void exit(int exitcode) {
// start in new thread so that we might have a chance to give positive
// feed back to requesting client of success.
new Thread()
{
public void run()
{
log.info("Shutting down the JVM now!");
Runtime.getRuntime().exit(exitcode);
}
}.start();
}
Shutdown the server, the JVM and run shutdown hooks. |
public String getBuildDate() {
return version.getBuildDate();
}
|
public String getBuildID() {
return version.getBuildID();
}
|
public String getBuildNumber() {
return version.getBuildNumber();
}
|
public ServerConfig getConfig() throws IllegalStateException {
if (config == null)
throw new IllegalStateException("not initialized");
return config;
}
Get the typed server configuration object which the
server has been initalized to use. |
public MBeanNotificationInfo[] getNotificationInfo() {
return broadcasterSupport.getNotificationInfo();
}
|
public Date getStartDate() {
return startDate;
}
|
public String getVersion() {
return version.toString();
}
|
public String getVersionName() {
return version.getName();
}
|
public void halt() {
halt(1);
}
Forcibly terminates the currently running Java virtual machine.
Exits with code 1. |
public void halt(int exitcode) {
// Send a notification that the startup is complete
Notification msg = new Notification(STOP_NOTIFICATION_TYPE, this, 2);
sendNotification(msg);
// start in new thread so that we might have a chance to give positive
// feed back to requesting client of success.
new Thread()
{
public void run()
{
System.err.println("Halting the system now!");
Runtime.getRuntime().halt(exitcode);
}
}.start();
}
Forcibly terminates the currently running Java virtual machine. |
public void init(Properties props) throws Exception, IllegalStateException {
if (props == null)
throw new IllegalArgumentException("props is null");
if (config != null)
throw new IllegalStateException("already initialized");
ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
doInit(props);
}
finally
{
Thread.currentThread().setContextClassLoader(oldCL);
}
}
Initialize the Server instance. |
public boolean isStarted() {
return started;
}
Check if the server is started. |
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException {
broadcasterSupport.removeNotificationListener(listener);
}
|
public void runFinalization() {
Runtime.getRuntime().runFinalization();
log.info("Hinted to the JVM to run any pending object finalizations");
}
Hint to the JVM to run any pending object finailizations. |
public void runGarbageCollector() {
Runtime rt = Runtime.getRuntime();
logMemoryUsage(rt);
rt.gc();
log.info("Hinted to the JVM to run garbage collection");
logMemoryUsage(rt);
}
Hint to the JVM to run the garbage collector. |
public void sendNotification(Notification notification) {
broadcasterSupport.sendNotification(notification);
}
|
public void shutdown() throws IllegalStateException {
if (!started)
throw new IllegalStateException("not started");
final ServerImpl server = this;
log.info("Shutting down");
boolean exitOnShutdown = config.getExitOnShutdown();
boolean blockingShutdown = config.getBlockingShutdown();
if (log.isDebugEnabled())
{
log.debug("exitOnShutdown: " + exitOnShutdown);
log.debug("blockingShutdown: " + blockingShutdown);
}
lifeThread.interrupt();
if (exitOnShutdown)
{
server.exit(0);
}
else if (blockingShutdown)
{
shutdownHook.shutdown();
} // end of if ()
else
{
// start in new thread to give positive
// feedback to requesting client of success.
new Thread()
{
public void run()
{
// just run the hook, don't call System.exit, as we may
// be embeded in a vm that would not like that very much
shutdownHook.shutdown();
}
}.start();
}
}
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. |
public void start() throws Exception, IllegalStateException {
// make sure we are initialized
getConfig();
// make sure we aren't started yet
if (started)
throw new IllegalStateException("already started");
ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
// Deal with those pesky JMX throwables
try
{
doStart();
}
catch (Exception e)
{
JMXExceptionDecoder.rethrow(e);
}
}
catch (Throwable t)
{
log.debug("Failed to start", t);
if (t instanceof Exception)
throw (Exception)t;
if (t instanceof Error)
throw (Error)t;
throw new org.jboss.util.UnexpectedThrowable(t);
}
finally
{
Thread.currentThread().setContextClassLoader(oldCL);
}
}
Start the Server instance. |
public void traceInstructions(Boolean flag) {
Runtime.getRuntime().traceInstructions(flag.booleanValue());
}
Enable or disable tracing instructions the Runtime level. |
public void traceMethodCalls(Boolean flag) {
Runtime.getRuntime().traceMethodCalls(flag.booleanValue());
}
Enable or disable tracing method calls at the Runtime level. |