001: /*
002: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
004: *
005: * This program is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU General Public License version
007: * 2 only, as published by the Free Software Foundation.
008: *
009: * This program is distributed in the hope that it will be useful, but
010: * WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * General Public License version 2 for more details (a copy is
013: * included at /legal/license.txt).
014: *
015: * You should have received a copy of the GNU General Public License
016: * version 2 along with this work; if not, write to the Free Software
017: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
018: * 02110-1301 USA
019: *
020: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
021: * Clara, CA 95054 or visit www.sun.com if you need additional
022: * information or have any questions.
023: */
024:
025: package com.sun.jump.isolate.jvmprocess;
026:
027: /**
028: * This interface specifies methods of the object passed to the static
029: * factory method of <code>JUMPAppContainer</code>. The methods enable
030: * a container to discover information about its environment, as well
031: * as a way to signal <code>JUMPApplication</code> state changes.
032: *
033: * The implementation of the <code>JUMPAppContainerContext</code> should
034: * start off a non-daemon thread to ensure the process will not naturally die
035: * before the application's startApp() method is invoked.
036: *
037: * @see <code>com.sun.jump.isolate.jvmprocess.JUMPAppContainer</code>
038: */
039: public interface JUMPAppContainerContext {
040: /**
041: * Called by an <code>JUMPAppContainer</code> to notify central
042: * AMS that a <code>JUMPApplication</code> has entered into the
043: * <em>Destroyed</em> state.
044: * <p>
045: * If this method was called because the the last application in
046: * the container was destroyed, then <em>after</em> this returns the
047: * container should call <code>terminateIsolate</code>
048: * and not <code>System.exit</code>.
049: * <p>
050: * This method may be called in any state, assuming the central AMS is
051: * keeping track of state changes and will ignore extra notifications.
052: *
053: * @param appId runtime ID of the application assigned by
054: * <code>JUMPAppContainer.startApp</code>
055: */
056: void notifyDestroyed(int appId);
057:
058: /**
059: * Called by an <code>JUMPAppContainer</code> to notify central
060: * AMS that a <code>JUMPApplication</code> has entered into the
061: * <em>PausedDestroyed</em> state.
062: * <p>
063: * This method may be called in any state, assuming the central AMS is
064: * keeping track of state changes and will ignore extra notifications.
065: *
066: * @param appId runtime ID of the application assigned by
067: * <code>JUMPAppContainer.startApp</code>
068: */
069: void notifyPaused(int appId);
070:
071: /**
072: * Called by an <code>JUMPAppContainer</code> to foreward a request for
073: * a <code>JUMPApplication</code> to the central AMS to be allowed to
074: * enter <em>Active</em> state.
075: * <p>
076: * This method may be called in any state, assuming the central AMS is
077: * keeping track of state changes and will ignore extra requests.
078: *
079: * @param appId runtime ID of the application assigned by
080: * <code>JUMPAppContainer.startApp</code>
081: */
082: void resumeRequest(int appId);
083:
084: /**
085: * Provides an <code>JUMPAppContainer</code> with a mechanism to retrieve
086: * JUMP configuration properties.
087: *
088: * @param key name of the property
089: *
090: * @return value of the property or <code>null</code>,
091: * if no value is available for property
092: */
093: String getConfigProperty(String key);
094:
095: /**
096: * Called to terminate the isolate gracefully.
097: */
098: void terminateIsolate();
099:
100: /**
101: * Called to terminate the non-daemon thread running in this context.
102: */
103: void terminateKeepAliveThread();
104: }
|