Class AllocateServerSocketServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.pentaho.di.www.BaseHttpServlet
-
- org.pentaho.di.www.AllocateServerSocketServlet
-
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
,CartePluginInterface
,CarteServletInterface
public class AllocateServerSocketServlet extends BaseHttpServlet implements CartePluginInterface
This servlet allows a client (TransSplitter in our case) to ask for a port number.
This port number will be allocated in such a way that the port number is unique for a given hostname.
This in turn will ensure that all the slaves will use valid port numbers, even if multiple slaves run on the same host.- Author:
- matt
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONTEXT_PATH
static String
PARAM_HOSTNAME
static String
PARAM_ID
static String
PARAM_RANGE_START
static String
PARAM_SOURCE_SLAVE
static String
PARAM_SOURCE_STEPCOPY
static String
PARAM_SOURCE_STEPNAME
static String
PARAM_TARGET_SLAVE
static String
PARAM_TARGET_STEPCOPY
static String
PARAM_TARGET_STEPNAME
static String
PARAM_TRANSFORMATION_NAME
static String
XML_TAG_PORT
-
Fields inherited from class org.pentaho.di.www.BaseHttpServlet
detections, jobMap, log, socketRepository, transformationMap
-
-
Constructor Summary
Constructors Constructor Description AllocateServerSocketServlet()
AllocateServerSocketServlet(TransformationMap transformationMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
String
getContextPath()
String
getService()
String
toString()
-
Methods inherited from class org.pentaho.di.www.BaseHttpServlet
convertContextPath, doDelete, doPost, doPut, getDetections, getJobMap, getSocketRepository, getTransformationMap, isJettyMode, logBasic, logBasic, logDebug, logDetailed, logDetailed, logError, logError, logError, logMinimal, logRowlevel, setJettyMode, setup
-
Methods inherited from class javax.servlet.http.HttpServlet
doHead, doOptions, doTrace, getLastModified, service, service
-
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.pentaho.di.www.CartePluginInterface
isJettyMode, setJettyMode, setup
-
-
-
-
Field Detail
-
CONTEXT_PATH
public static final String CONTEXT_PATH
- See Also:
- Constant Field Values
-
PARAM_RANGE_START
public static final String PARAM_RANGE_START
- See Also:
- Constant Field Values
-
PARAM_HOSTNAME
public static final String PARAM_HOSTNAME
- See Also:
- Constant Field Values
-
PARAM_ID
public static final String PARAM_ID
- See Also:
- Constant Field Values
-
PARAM_TRANSFORMATION_NAME
public static final String PARAM_TRANSFORMATION_NAME
- See Also:
- Constant Field Values
-
PARAM_SOURCE_SLAVE
public static final String PARAM_SOURCE_SLAVE
- See Also:
- Constant Field Values
-
PARAM_SOURCE_STEPNAME
public static final String PARAM_SOURCE_STEPNAME
- See Also:
- Constant Field Values
-
PARAM_SOURCE_STEPCOPY
public static final String PARAM_SOURCE_STEPCOPY
- See Also:
- Constant Field Values
-
PARAM_TARGET_SLAVE
public static final String PARAM_TARGET_SLAVE
- See Also:
- Constant Field Values
-
PARAM_TARGET_STEPNAME
public static final String PARAM_TARGET_STEPNAME
- See Also:
- Constant Field Values
-
PARAM_TARGET_STEPCOPY
public static final String PARAM_TARGET_STEPCOPY
- See Also:
- Constant Field Values
-
XML_TAG_PORT
public static final String XML_TAG_PORT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AllocateServerSocketServlet
public AllocateServerSocketServlet()
-
AllocateServerSocketServlet
public AllocateServerSocketServlet(TransformationMap transformationMap)
-
-
Method Detail
-
doGet
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
/kettle/allocateSocket
GET
Allocates port to use by client. Allows any client to ask for a port number to use. This is necessary several slaves can be run on the same host. The method ensures the port number is unique for host name provided and makes sure the slaves are using valid port numbers. Data communication across a cluster of Carte servers happens through TCP/IP sockets. Slave transformations sometimes open (or listen to) tens to hundreds of sockets. When you want to allocate the port numbers for data communication between slave transformation in a kettle clustering run, you need unique combinations of all the parameters below.
port number
will be returned in the Response object. If an error occurred you'll receive html output describing the problem. HTTP status code of such response is 500.Example Request:
GET /kettle/allocateSocket/?xml=Y&rangeStart=100&host=locahost&id=clust&trans=my_trans&sourceSlave=slave_1 &sourceStep=200&sourceCopy=1&targetSlave=slave_2&targetStep=50&targetCopy=1
Parameters
name description type xml Boolean flag set to either Y
orN
describing if xml or html reply should be produced.boolean, optional rangeStart Port number to start looking from. integer host Port's host. query id Carte container id. query trans Running transformation id. query sourceSlave Name of the source slave server. query sourceStep Port number step used on source slave server. integer sourceCopy Number of copies of the step on source server. integer targetSlave Name of the target slave server. query targetStep Port number step used on target slave server. integer targetCopy Number of copies of the step on target server. integer Response Body
element: (custom) media types: text/xml, text/html Response wraps port number that was allocated or error stack trace if an error occurred. Response HTTP code is 200 if there were no errors. Otherwise it is 500.
Example Response:
100 Status Codes
code description 200 Request was processed and XML response is returned. 500 Internal server error occurs during request processing. This might also be caused by missing request parameter. - Specified by:
doGet
in interfaceCartePluginInterface
- Overrides:
doGet
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
-
getService
public String getService()
- Specified by:
getService
in interfaceCarteServletInterface
-
getContextPath
public String getContextPath()
- Specified by:
getContextPath
in interfaceCartePluginInterface
-
-