Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 8580 invoked by uid 500); 29 Oct 2002 22:29:29 -0000 Mailing-List: contact axis-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@xml.apache.org Received: (qmail 8567 invoked by uid 500); 29 Oct 2002 22:29:29 -0000 Delivered-To: apmail-xml-axis-cvs@apache.org Date: 29 Oct 2002 22:29:27 -0000 Message-ID: <20021029222927.91057.qmail@icarus.apache.org> From: jmsnell@apache.org To: xml-axis-cvs@apache.org Subject: cvs commit: xml-axis/java/src/org/apache/axis/ime MessageExchangeLifecycle.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N jmsnell 2002/10/29 14:29:27 Modified: java/src/org/apache/axis/ime/internal/util WorkerPool.java java/src/org/apache/axis/ime/internal MessageExchangeImpl.java MessageExchangeProvider.java java/src/org/apache/axis/ime MessageExchangeLifecycle.java Log: Added a cleanup operation to the MessageExchangeLifecycle Revision Changes Path 1.2 +12 -1 xml-axis/java/src/org/apache/axis/ime/internal/util/WorkerPool.java Index: WorkerPool.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/util/WorkerPool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- WorkerPool.java 29 Oct 2002 05:15:30 -0000 1.1 +++ WorkerPool.java 29 Oct 2002 22:29:26 -0000 1.2 @@ -69,9 +69,20 @@ public static final long MAX_THREADS = 100; protected Map threads = new Hashtable(); - protected boolean interrupt; protected long threadcount; public boolean _shutdown; + + public void cleanup() + throws InterruptedException { + if (!isShutdown()) { + safeShutdown(); + awaitShutdown(); + } + synchronized(this) { + threads.clear(); + _shutdown = false; + } + } /** * Returns true if all workers have been shutdown 1.6 +8 -0 xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeImpl.java Index: MessageExchangeImpl.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeImpl.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- MessageExchangeImpl.java 29 Oct 2002 06:39:57 -0000 1.5 +++ MessageExchangeImpl.java 29 Oct 2002 22:29:26 -0000 1.6 @@ -440,6 +440,14 @@ } /** + * @see org.apache.axis.ime.MessageExchangeLifecycle#cleanup() + */ + public void cleanup() + throws InterruptedException { + provider.cleanup(); + } + + /** * @see org.apache.axis.ime.MessageExchangeLifecycle#awaitShutdown(long) */ public void awaitShutdown(long timeout) 1.5 +5 -1 xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeProvider.java Index: MessageExchangeProvider.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeProvider.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- MessageExchangeProvider.java 29 Oct 2002 06:39:57 -0000 1.4 +++ MessageExchangeProvider.java 29 Oct 2002 22:29:26 -0000 1.5 @@ -105,7 +105,11 @@ new UnsupportedOperationException( Messages.getMessage("unsupportedOperationException00"))); } - + + public void cleanup() + throws InterruptedException { + WORKERS.cleanup(); + } public void init() { init(DEFAULT_THREAD_COUNT); 1.4 +26 -0 xml-axis/java/src/org/apache/axis/ime/MessageExchangeLifecycle.java Index: MessageExchangeLifecycle.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchangeLifecycle.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- MessageExchangeLifecycle.java 28 Oct 2002 21:45:59 -0000 1.3 +++ MessageExchangeLifecycle.java 29 Oct 2002 22:29:27 -0000 1.4 @@ -63,15 +63,41 @@ */ public interface MessageExchangeLifecycle { + /** + * Initialize the lifecycle. (Create threads, etc) + */ public void init(); + /** + * Cleanup + */ + public void cleanup() + throws InterruptedException ; + + /** + * Performs a "safe shutdown", allowing all + * current activities to complete. + */ public void shutdown(); + /** + * Performs an "unsafe shutdown", interrupting + * all current activities without letting + * them complete + */ public void shutdown(boolean force); + /** + * Block indefinitely until shutdown is + * complete + */ public void awaitShutdown() throws InterruptedException; + /** + * Block for the specified amount of time + * or until shutdown is complete + */ public void awaitShutdown(long timeout) throws InterruptedException;