php.java.bridge.http
Class ContextRunner

java.lang.Object
  extended by php.java.bridge.http.ContextRunner
All Implemented Interfaces:
java.lang.Runnable

public class ContextRunner
extends java.lang.Object
implements java.lang.Runnable

The ContextRunner usually represents the physical connection, it manages the "high speed" communication link. It pulls a ContextFactory and executes it. After execution the context is destroyed.

ContextRunners are kept in a per-loader map and each client may refer to its runner by keeping a persistent connection to it. The ContextFactory may ignore this and prepare for a new physical connection by sending back the ID of a new ContextServer. This usually happens when there are two separate bridges installed in context A and context B and the client uses a persistent connection to context A. An attempt to re-use the same connection for B fails because the classes are loaded via two separate class loaders. For named pipes this means that the connection should have been prepared and sent via X_JAVABRIDGE_CHANNEL, as usual. Otherwise the bridge will use the SocketContextServer instead. -- The client may destroy the new pipe if the server has accepted the previous ID, of course.

Example: Two web apps WA1 and WA2, two ContextServers, @9667 and @9668. Client has persistent connection to @9667, sends initial HTTP PUT request to WA2. WA2 responds with a redirect to @9668. Client uses this new persistent connection (but keeps persistent connection to @9667, of course).


Constructor Summary
ContextRunner(AbstractChannel channel, ILogger logger)
          Create a new ContextRunner from a ThreadPool
 
Method Summary
 void run()
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextRunner

public ContextRunner(AbstractChannel channel,
                     ILogger logger)
Create a new ContextRunner from a ThreadPool

Parameters:
channel - the communication channel
logger - the current logger
Method Detail

run

public void run()

Specified by:
run in interface java.lang.Runnable