php.java.bridge.http
Class SocketContextServer

java.lang.Object
  extended by php.java.bridge.http.SocketContextServer
All Implemented Interfaces:
java.lang.Runnable, IContextServer

public final class SocketContextServer
extends java.lang.Object
implements java.lang.Runnable, IContextServer

This class manages the fallback physical connection for the operating system which doesn't support named pipes, "Windows", or when the System property php.java.bridge.promiscuous is set to true.

When isAvailable() returns true, a server socket bound to the local interface (127.0.0.1) has been created on a port in the range [9267,...,[9367 and will be used for further communication, see response header X_JAVABRIDGE_REDIRECT. If this communication channel is not available either, the PHP clients must continue to send all statements via PUT requests.

It is possible to switch off this server by setting the VM property php.java.bridge.no_socket_server to true, e.g.: -Dphp.java.bridge.no_socket_server=true.

See Also:
ContextServer

Field Summary
static boolean SOCKET_SERVER_AVAIL
           
 
Constructor Summary
SocketContextServer(AppThreadPool threadPool, boolean promiscuous, java.lang.String contextName)
          Create a new ContextServer using the ThreadPool.
 
Method Summary
 void destroy()
          Destroy the server
 java.lang.String getChannelName()
          Returns the server port.
 boolean isAvailable()
          Check if the ContextServer is ready, i.e.
 void run()
          
 boolean start(AbstractChannelName channelName, ILogger logger)
          Start the runner.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOCKET_SERVER_AVAIL

public static final boolean SOCKET_SERVER_AVAIL
Constructor Detail

SocketContextServer

public SocketContextServer(AppThreadPool threadPool,
                           boolean promiscuous,
                           java.lang.String contextName)
Create a new ContextServer using the ThreadPool.

Parameters:
threadPool - Obtain runnables from this pool. If null, new threads will be created.
Method Detail

run

public void run()

Specified by:
run in interface java.lang.Runnable

destroy

public void destroy()
Destroy the server

Specified by:
destroy in interface IContextServer

isAvailable

public boolean isAvailable()
Check if the ContextServer is ready, i.e. it has created a server socket.

Specified by:
isAvailable in interface IContextServer
Returns:
true if there's a server socket listening, false otherwise.

getChannelName

public java.lang.String getChannelName()
Returns the server port.

Returns:
The server port.

start

public boolean start(AbstractChannelName channelName,
                     ILogger logger)
Start the runner.

Specified by:
start in interface IContextServer
Parameters:
channelName - The channel name
Returns:
true on success, false otherwise