hammant 2003/01/29 00:01:13 Modified: altrmi/src/java/org/apache/excalibur/altrmi/client ClientInvocationHandler.java altrmi/src/java/org/apache/excalibur/altrmi/client/impl AbstractClientInvocationHandler.java AbstractConnectionPinger.java altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/socket CallbackEnabledSocketCustomStreamInvocationHandler.java altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/stream CallbackEnabledClientCustomStreamReadWriter.java altrmi/src/java/org/apache/excalibur/altrmi/client/impl/multiple RotatingMultipleInvocationHandler.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl AbstractServer.java ServerStreamReadWriter.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket CallbackEnabledSocketCustomStreamReadWriter.java CallbackEnabledSocketCustomStreamServer.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl/http CustomHttpServer.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped AbstractPipedServer.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket AbstractCompleteSocketStreamServer.java altrmi/src/test/org/apache/excalibur/altrmi/test DummyInvocationHandler.java Added: altrmi/src/java/org/apache/excalibur/altrmi/common DefaultThreadContext.java DefaultThreadContextProvider.java ThreadContext.java ThreadContextProvider.java ThreadContextProviderAware.java Log: ThreadPool started. Dummy impl provided. Revision Changes Path 1.6 +3 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/ClientInvocationHandler.java Index: ClientInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/ClientInvocationHandler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ClientInvocationHandler.java 19 Jan 2003 22:10:52 -0000 1.5 +++ ClientInvocationHandler.java 29 Jan 2003 08:01:12 -0000 1.6 @@ -10,6 +10,7 @@ import org.apache.excalibur.altrmi.common.InvocationHandler; import org.apache.excalibur.altrmi.common.ConnectionException; import org.apache.excalibur.altrmi.common.CallbackException; +import org.apache.excalibur.altrmi.common.ThreadContextProviderAware; /** * Interface ClientInvocationHandler @@ -18,7 +19,7 @@ * @author Paul Hammant * @version * $Revision$ */ -public interface ClientInvocationHandler extends InvocationHandler +public interface ClientInvocationHandler extends InvocationHandler, ThreadContextProviderAware { /** 1.14 +22 -10 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractClientInvocationHandler.java Index: AbstractClientInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractClientInvocationHandler.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- AbstractClientInvocationHandler.java 19 Jan 2003 22:10:52 -0000 1.13 +++ AbstractClientInvocationHandler.java 29 Jan 2003 08:01:12 -0000 1.14 @@ -7,19 +7,16 @@ */ package org.apache.excalibur.altrmi.client.impl; -import java.io.IOException; - import org.apache.excalibur.altrmi.client.ClientInvocationHandler; +import org.apache.excalibur.altrmi.client.ConnectionClosedException; import org.apache.excalibur.altrmi.client.ConnectionListener; import org.apache.excalibur.altrmi.client.ConnectionPinger; -import org.apache.excalibur.altrmi.client.Proxy; -import org.apache.excalibur.altrmi.client.ConnectionClosedException; -import org.apache.excalibur.altrmi.common.InvocationHandler; -import org.apache.excalibur.altrmi.common.Reply; -import org.apache.excalibur.altrmi.common.FacadeRefHolder; -import org.apache.excalibur.altrmi.common.PingRequest; -import org.apache.excalibur.altrmi.common.ConnectionException; import org.apache.excalibur.altrmi.common.CallbackException; +import org.apache.excalibur.altrmi.common.ConnectionException; +import org.apache.excalibur.altrmi.common.PingRequest; +import org.apache.excalibur.altrmi.common.Reply; +import org.apache.excalibur.altrmi.common.ThreadContextProvider; +import org.apache.excalibur.altrmi.common.DefaultThreadContextProvider; /** * Class AbstractClientInvocationHandler @@ -36,6 +33,7 @@ protected ConnectionListener m_connectionListener = new DefaultConnectionListener(); protected boolean m_stopped = false; + private ThreadContextProvider m_threadContextProvider; /** * Method setConnectionListener @@ -52,6 +50,20 @@ public ConnectionListener getConnectionListener() { return m_connectionListener; + } + + public void setThreadContextProvider(ThreadContextProvider threadContextProvider) + { + m_threadContextProvider = threadContextProvider; + } + + public synchronized ThreadContextProvider getThreadContextProvider() + { + if (m_threadContextProvider == null) + { + m_threadContextProvider = new DefaultThreadContextProvider(); + } + return m_threadContextProvider; } /** 1.14 +7 -6 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractConnectionPinger.java Index: AbstractConnectionPinger.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractConnectionPinger.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- AbstractConnectionPinger.java 19 Jan 2003 11:09:59 -0000 1.13 +++ AbstractConnectionPinger.java 29 Jan 2003 08:01:12 -0000 1.14 @@ -11,6 +11,7 @@ import org.apache.excalibur.altrmi.client.ConnectionPinger; import org.apache.excalibur.altrmi.client.ConnectionClosedException; import org.apache.excalibur.altrmi.common.InvocationException; +import org.apache.excalibur.altrmi.common.ThreadContext; /** * Interface AbstractConnectionPinger @@ -25,7 +26,7 @@ private ClientInvocationHandler m_clientInvocationHandler; private boolean m_continue = true; private Runnable m_runnable; - private Thread m_thread; + private ThreadContext m_threadContext; private final long m_pingInterval; private final long m_giveupInterval; @@ -129,8 +130,8 @@ } }; - m_thread = new Thread( m_runnable ,"ConnectionPinger Thread"); - m_thread.start(); + m_threadContext = m_clientInvocationHandler.getThreadContextProvider().getThreadContext(m_runnable); + m_threadContext.start(); } /** @@ -141,8 +142,8 @@ public void stop() { m_continue = false; - m_thread.interrupt(); - m_thread = null; + m_threadContext.interrupt(); + m_threadContext = null; } protected abstract void ping(); 1.15 +4 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/socket/CallbackEnabledSocketCustomStreamInvocationHandler.java Index: CallbackEnabledSocketCustomStreamInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/socket/CallbackEnabledSocketCustomStreamInvocationHandler.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- CallbackEnabledSocketCustomStreamInvocationHandler.java 19 Jan 2003 22:10:52 -0000 1.14 +++ CallbackEnabledSocketCustomStreamInvocationHandler.java 29 Jan 2003 08:01:13 -0000 1.15 @@ -39,6 +39,8 @@ super( host, port, classLoader ); } + + /* * @see AbstractSocketStreamInvocationHandler#createClientStreamReadWriter(InputStream, OutputStream) */ @@ -47,7 +49,7 @@ { if( m_callbackEnabledClientCustomStreamReadWriter == null ) { - m_callbackEnabledClientCustomStreamReadWriter = new CallbackEnabledClientCustomStreamReadWriter( in, out, m_interfacesClassLoader ); + m_callbackEnabledClientCustomStreamReadWriter = new CallbackEnabledClientCustomStreamReadWriter( getThreadContextProvider(), in, out, m_interfacesClassLoader ); } return m_callbackEnabledClientCustomStreamReadWriter; } 1.12 +9 -5 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/stream/CallbackEnabledClientCustomStreamReadWriter.java Index: CallbackEnabledClientCustomStreamReadWriter.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/stream/CallbackEnabledClientCustomStreamReadWriter.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- CallbackEnabledClientCustomStreamReadWriter.java 19 Jan 2003 11:10:00 -0000 1.11 +++ CallbackEnabledClientCustomStreamReadWriter.java 29 Jan 2003 08:01:13 -0000 1.12 @@ -21,6 +21,8 @@ import org.apache.excalibur.altrmi.common.Request; import org.apache.excalibur.altrmi.common.SerializationHelper; import org.apache.excalibur.altrmi.common.ConnectionException; +import org.apache.excalibur.altrmi.common.ThreadContextProvider; +import org.apache.excalibur.altrmi.common.ThreadContext; import org.apache.excalibur.altrmi.server.Server; import org.apache.excalibur.altrmi.server.PublicationException; import org.apache.excalibur.altrmi.server.ServerException; @@ -42,7 +44,7 @@ //Mutex to block the client till a reply reaches back from server private Object m_replyLock = new Object(); private Reply m_reply = null; - private Thread m_messageLoopThread = null; + private ThreadContext m_messageLoopThreadContext = null; private boolean m_isStopped = false; private DataInputStream m_dataInputStream; private DataOutputStream m_dataOutputStream; @@ -50,6 +52,7 @@ private HashMap m_exposedObjPublishNameHash_ = new HashMap(); private Server m_clientServerHostingExposedObjects = new DirectServer(); private static int m_random = 0; + private ThreadContextProvider m_threadContextProvider; /** * Constructor ClientCustomStreamReadWriter @@ -61,16 +64,17 @@ * @throws ConnectionException The IO Exception * */ - public CallbackEnabledClientCustomStreamReadWriter( InputStream inputStream, OutputStream outputStream, ClassLoader interfacesClassLoader ) + public CallbackEnabledClientCustomStreamReadWriter( ThreadContextProvider threadContextProvider, InputStream inputStream, OutputStream outputStream, ClassLoader interfacesClassLoader ) throws ConnectionException { + this.m_threadContextProvider = threadContextProvider; m_dataOutputStream = new DataOutputStream( new BufferedOutputStream( outputStream ) ); m_dataInputStream = new DataInputStream( inputStream ); m_interfacesClassLoader = interfacesClassLoader; //This thread recv's all the messages sent from the server - m_messageLoopThread = new Thread( this,"CallbackEnabledClientStream Thread" ); - m_messageLoopThread.start(); + m_messageLoopThreadContext = m_threadContextProvider.getThreadContext(this); + m_messageLoopThreadContext.start(); //start the internal Server which holds the exposed Objects // for the server to make callbacks upon. try 1.9 +14 -1 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/multiple/RotatingMultipleInvocationHandler.java Index: RotatingMultipleInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/multiple/RotatingMultipleInvocationHandler.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- RotatingMultipleInvocationHandler.java 5 Jan 2003 23:24:10 -0000 1.8 +++ RotatingMultipleInvocationHandler.java 29 Jan 2003 08:01:13 -0000 1.9 @@ -12,6 +12,7 @@ import org.apache.excalibur.altrmi.common.PingReply; import org.apache.excalibur.altrmi.common.PingRequest; import org.apache.excalibur.altrmi.common.Sessionable; +import org.apache.excalibur.altrmi.common.ThreadContextProvider; /** * Class RotatingMultipleInvocationHandler @@ -112,4 +113,16 @@ .handleInvocation( request ); } } + + public void setThreadContextProvider(ThreadContextProvider threadContextProvider) + { + //TODO + } + + public ThreadContextProvider getThreadContextProvider() + { + //TODO + return null; + } + } 1.14 +22 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/AbstractServer.java Index: AbstractServer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/AbstractServer.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- AbstractServer.java 19 Jan 2003 11:10:00 -0000 1.13 +++ AbstractServer.java 29 Jan 2003 08:01:13 -0000 1.14 @@ -11,6 +11,10 @@ import org.apache.excalibur.altrmi.common.Reply; import org.apache.excalibur.altrmi.common.Request; import org.apache.excalibur.altrmi.common.MethodRequest; +import org.apache.excalibur.altrmi.common.ThreadContextProvider; +import org.apache.excalibur.altrmi.common.ThreadContext; +import org.apache.excalibur.altrmi.common.DefaultThreadContextProvider; +import org.apache.excalibur.altrmi.common.ThreadContextProviderAware; import org.apache.excalibur.altrmi.server.Authenticator; import org.apache.excalibur.altrmi.server.Server; import org.apache.excalibur.altrmi.server.ServerConnection; @@ -30,7 +34,7 @@ * @version $Revision$ */ public abstract class AbstractServer - implements Server + implements Server, ThreadContextProviderAware { /** @@ -49,6 +53,7 @@ private int m_state = UNSTARTED; private ServerMonitor m_serverMonitor; + private ThreadContextProvider m_threadContextProvider; /** * Construct a AbstractServer @@ -76,6 +81,21 @@ return m_serverMonitor; } + + public void setThreadContextProvider(ThreadContextProvider threadContextProvider) + { + m_threadContextProvider = threadContextProvider; + } + + public synchronized ThreadContextProvider getThreadContextProvider() + { + if (m_threadContextProvider == null) + { + m_threadContextProvider = new DefaultThreadContextProvider(); + } + return m_threadContextProvider; + } + /** * Set a ClassRetriever to use. 1.11 +15 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/ServerStreamReadWriter.java Index: ServerStreamReadWriter.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/ServerStreamReadWriter.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ServerStreamReadWriter.java 19 Jan 2003 11:10:00 -0000 1.10 +++ ServerStreamReadWriter.java 29 Jan 2003 08:01:13 -0000 1.11 @@ -13,7 +13,9 @@ import org.apache.excalibur.altrmi.common.Reply; import org.apache.excalibur.altrmi.common.Request; import org.apache.excalibur.altrmi.common.ConnectionException; +import org.apache.excalibur.altrmi.common.ThreadContextProvider; import org.apache.excalibur.altrmi.server.ServerMonitor; +import org.apache.excalibur.altrmi.common.ThreadContextProviderAware; /** @@ -23,9 +25,10 @@ * @author Paul Hammant * @version $Revision$ */ -public abstract class ServerStreamReadWriter +public abstract class ServerStreamReadWriter implements ThreadContextProviderAware { + /** * The input stream */ @@ -37,11 +40,21 @@ private OutputStream m_outputStream; private ServerMonitor m_serverMonitor; + private ThreadContextProvider m_threadContextProvider; private void setServerMonitor(ServerMonitor serverMonitor) { m_serverMonitor = serverMonitor; } + public void setThreadContextProvider(ThreadContextProvider threadContextProvider) + { + m_threadContextProvider = threadContextProvider; + } + + public ThreadContextProvider getThreadContextProvider() + { + return m_threadContextProvider; + } /** * Method setStreams 1.10 +5 -4 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket/CallbackEnabledSocketCustomStreamReadWriter.java Index: CallbackEnabledSocketCustomStreamReadWriter.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket/CallbackEnabledSocketCustomStreamReadWriter.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- CallbackEnabledSocketCustomStreamReadWriter.java 9 Jan 2003 22:55:12 -0000 1.9 +++ CallbackEnabledSocketCustomStreamReadWriter.java 29 Jan 2003 08:01:13 -0000 1.10 @@ -17,6 +17,8 @@ import org.apache.excalibur.altrmi.common.ExposedObjectProxy; import org.apache.excalibur.altrmi.common.MethodRequest; import org.apache.excalibur.altrmi.common.SerializationHelper; +import org.apache.excalibur.altrmi.common.ThreadContext; +import org.apache.excalibur.altrmi.common.ThreadContextProvider; import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter; import org.apache.excalibur.altrmi.server.impl.callback.CallbackHostContext; import org.apache.excalibur.altrmi.server.impl.callback.CallbackServerClassFactory; @@ -40,7 +42,7 @@ private DataInputStream m_dataInputStream; private DataOutputStream m_dataOutputStream; - private Thread m_messageLoopThread = null; + private ThreadContext m_messageLoopThread = null; private boolean m_isStopped = false; private Object m_requestLock = new Object(); private Object m_replyLock = new Object(); @@ -61,8 +63,7 @@ m_dataOutputStream = new DataOutputStream( new BufferedOutputStream( getOutputStream() ) ); //start the receiving message loop - m_messageLoopThread = new Thread( this ,"CallbackEnabledServer Thread"); - + m_messageLoopThread = getThreadContextProvider().getThreadContext(this); m_messageLoopThread.start(); } 1.5 +4 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket/CallbackEnabledSocketCustomStreamServer.java Index: CallbackEnabledSocketCustomStreamServer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket/CallbackEnabledSocketCustomStreamServer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- CallbackEnabledSocketCustomStreamServer.java 5 Jan 2003 23:24:45 -0000 1.4 +++ CallbackEnabledSocketCustomStreamServer.java 29 Jan 2003 08:01:13 -0000 1.5 @@ -65,6 +65,8 @@ */ protected ServerStreamReadWriter createServerStreamReadWriter() { - return new CallbackEnabledSocketCustomStreamReadWriter(); + CallbackEnabledSocketCustomStreamReadWriter callbackEnabledSocketCustomStreamReadWriter = new CallbackEnabledSocketCustomStreamReadWriter(); + callbackEnabledSocketCustomStreamReadWriter.setThreadContextProvider(getThreadContextProvider()); + return callbackEnabledSocketCustomStreamReadWriter; } } 1.6 +4 -3 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/http/CustomHttpServer.java Index: CustomHttpServer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/http/CustomHttpServer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- CustomHttpServer.java 19 Jan 2003 14:22:45 -0000 1.5 +++ CustomHttpServer.java 29 Jan 2003 08:01:13 -0000 1.6 @@ -12,6 +12,7 @@ import org.apache.excalibur.altrmi.server.impl.ServerCustomStreamReadWriter; import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter; import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter; +import org.apache.excalibur.altrmi.common.ThreadContext; import java.io.InputStream; import java.io.OutputStream; @@ -99,9 +100,9 @@ hcsc.setServerMonitor(getServerMonitor()); - Thread thread = new Thread(hcsc, "SocketStreamServerConnection Thread"); + ThreadContext threadContext = getThreadContextProvider().getThreadContext(hcsc); - thread.start(); + threadContext.start(); } } 1.9 +3 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped/AbstractPipedServer.java Index: AbstractPipedServer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped/AbstractPipedServer.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- AbstractPipedServer.java 19 Jan 2003 11:10:01 -0000 1.8 +++ AbstractPipedServer.java 29 Jan 2003 08:01:13 -0000 1.9 @@ -11,6 +11,7 @@ import java.io.PipedInputStream; import java.io.PipedOutputStream; import org.apache.excalibur.altrmi.common.ConnectionException; +import org.apache.excalibur.altrmi.common.ThreadContext; import org.apache.excalibur.altrmi.server.impl.AbstractServer; import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter; import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter; @@ -82,7 +83,7 @@ ssrw ); pssc.setServerMonitor(getServerMonitor()); - Thread thread = new Thread( pssc ,"PipedStreamServerConnection Thread"); + ThreadContext thread = getThreadContextProvider().getThreadContext(pssc); thread.start(); } 1.13 +13 -10 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/AbstractCompleteSocketStreamServer.java Index: AbstractCompleteSocketStreamServer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/AbstractCompleteSocketStreamServer.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- AbstractCompleteSocketStreamServer.java 19 Jan 2003 14:22:45 -0000 1.12 +++ AbstractCompleteSocketStreamServer.java 29 Jan 2003 08:01:13 -0000 1.13 @@ -15,6 +15,7 @@ import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter; import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter; import org.apache.excalibur.altrmi.common.AltrmiRuntimeException; +import org.apache.excalibur.altrmi.common.ThreadContext; /** @@ -36,7 +37,7 @@ /** * The thread handling the listening */ - private Thread m_thread; + private ThreadContext m_threadContext; /** * Construct a CompleteSocketObjectStreamServer @@ -109,9 +110,10 @@ sssc.setServerMonitor(getServerMonitor()); - Thread thread = new Thread( sssc, "SocketStreamServerConnection Thread" ); + //TODO ? Two of these getThreadContexts? PH + ThreadContext threadContext = getThreadContextProvider().getThreadContext(sssc); - thread.start(); + threadContext.start(); } } catch( IOException ioe ) @@ -137,7 +139,7 @@ { setState(STARTING); - getThread().start(); + getThreadContext().start(); setState(STARTED); } @@ -160,7 +162,7 @@ throw new AltrmiRuntimeException("Error stopping Complete Socket server", ioe); } killAllConnections(); - getThread().interrupt(); + getThreadContext().interrupt(); setState(STOPPED); } @@ -169,15 +171,16 @@ * Get the thread used for connection processing * @return */ - private Thread getThread() + private ThreadContext getThreadContext() { - if( m_thread == null ) + if( m_threadContext == null ) { - m_thread = new Thread( this, "SocketStreamServer" ); + m_threadContext = getThreadContextProvider().getThreadContext(this); + } - return m_thread; + return m_threadContext; } /** 1.3 +12 -0 jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/DummyInvocationHandler.java Index: DummyInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/DummyInvocationHandler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DummyInvocationHandler.java 19 Jan 2003 22:10:53 -0000 1.2 +++ DummyInvocationHandler.java 29 Jan 2003 08:01:13 -0000 1.3 @@ -11,6 +11,7 @@ import org.apache.excalibur.altrmi.common.Request; import org.apache.excalibur.altrmi.common.ConnectionException; import org.apache.excalibur.altrmi.common.CallbackException; +import org.apache.excalibur.altrmi.common.ThreadContextProvider; import org.apache.excalibur.altrmi.client.ClientInvocationHandler; import org.apache.excalibur.altrmi.client.ConnectionListener; import org.apache.excalibur.altrmi.client.ConnectionPinger; @@ -98,5 +99,16 @@ { throw new java.lang.UnsupportedOperationException(); } + + public void setThreadContextProvider(ThreadContextProvider threadContextProvider) + { + throw new java.lang.UnsupportedOperationException(); + } + + public ThreadContextProvider getThreadContextProvider() + { + throw new java.lang.UnsupportedOperationException(); + } + } 1.1 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/common/DefaultThreadContext.java Index: DefaultThreadContext.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.excalibur.altrmi.common; import org.apache.excalibur.altrmi.common.ThreadContext; /** * Class DefaultThreadContext * * * @author Paul Hammant * @version $Revision: 1.1 $ */ public class DefaultThreadContext implements ThreadContext { private Thread m_thread; public DefaultThreadContext(Runnable runnable) { m_thread = new Thread(runnable); } public void start() { m_thread.start(); } public void interrupt() { m_thread.interrupt(); } } 1.1 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/common/DefaultThreadContextProvider.java Index: DefaultThreadContextProvider.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.excalibur.altrmi.common; import org.apache.excalibur.altrmi.common.ThreadContextProvider; import org.apache.excalibur.altrmi.common.ThreadContext; import org.apache.excalibur.altrmi.common.DefaultThreadContext; /** * Class DefaultThreadContextProvider * * * @author Paul Hammant * @version $Revision: 1.1 $ */ public class DefaultThreadContextProvider implements ThreadContextProvider { public DefaultThreadContextProvider() { } public ThreadContext getThreadContext(Runnable runnable) { return new DefaultThreadContext(runnable); } } 1.1 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/common/ThreadContext.java Index: ThreadContext.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.excalibur.altrmi.common; /** * Class ThreadContext * * * @author Paul Hammant * @version $Revision: 1.1 $ */ public interface ThreadContext { void start(); void interrupt(); } 1.1 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/common/ThreadContextProvider.java Index: ThreadContextProvider.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.excalibur.altrmi.common; /** * Class ThreadContextProvider * * * @author Paul Hammant * @version $Revision: 1.1 $ */ public interface ThreadContextProvider { ThreadContext getThreadContext(Runnable runnable); } 1.1 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/common/ThreadContextProviderAware.java Index: ThreadContextProviderAware.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.excalibur.altrmi.common; import org.apache.excalibur.altrmi.common.ThreadContextProvider; /** * Class ThreadContextProviderAware * * * @author Paul Hammant * @version $Revision: 1.1 $ */ public interface ThreadContextProviderAware { void setThreadContextProvider(ThreadContextProvider threadContextProvider); ThreadContextProvider getThreadContextProvider(); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]