public final class GridRouterFactory extends Object
GridTcpRouterConfiguration and GridHttpRouterConfiguration
to set configuration parameters and pass them to
startTcpRouter(GridTcpRouterConfiguration) and startHttpRouter(GridHttpRouterConfiguration).
See GridTcpRouter and GridHttpRouter for example on how to configure and start embedded router.
GRIDGAIN_HOME/bin/ggrouter.sh or GRIDGAIN_HOME/bin/ggrouter.bat.
They both accept path to a configuration file as first command line argument.
See GRIDGAIN_HOME/clients/java/config/router/default-router.xml for configuration example.GridTcpRouter,
GridHttpRouter| Modifier and Type | Method and Description |
|---|---|
static Collection<GridHttpRouter> |
allHttpRouters()
Returns collection of all currently running HTTP routers.
|
static Collection<GridTcpRouter> |
allTcpRouters()
Returns collection of all currently running TCP routers.
|
static GridHttpRouter |
httpRouter(UUID id)
Returns HTTP router with given id.
|
static GridHttpRouter |
startHttpRouter(GridHttpRouterConfiguration cfg)
Starts a HTTP router with given configuration.
|
static GridTcpRouter |
startTcpRouter(GridTcpRouterConfiguration cfg)
Starts a TCP router with given configuration.
|
static void |
stopAllRouters()
Stops all currently active routers.
|
static void |
stopHttpRouter(UUID httpRouterId)
Stops particular HTTP router.
|
static void |
stopTcpRouter(UUID tcpRouterId)
Stops particular TCP router.
|
static GridTcpRouter |
tcpRouter(UUID id)
Returns TCP router with the given id.
|
public static GridTcpRouter startTcpRouter(GridTcpRouterConfiguration cfg) throws org.gridgain.grid.GridException
Starting router will be assigned a randomly generated UUID which can be obtained
by GridTcpRouter.id() method. Later this instance could be obtained via
tcpRouter(java.util.UUID) method.
cfg - Router configuration.org.gridgain.grid.GridException - If router start failed.public static void stopTcpRouter(UUID tcpRouterId)
tcpRouterId - Id of the router to stop.@Nullable public static GridTcpRouter tcpRouter(UUID id)
id - Router Id.null if router not found.public static Collection<GridTcpRouter> allTcpRouters()
GridTcpRouters.public static GridHttpRouter startHttpRouter(GridHttpRouterConfiguration cfg) throws org.gridgain.grid.GridException
Starting router will be assigned a randomly generated UUID which can be obtained
by GridTcpRouter.id() method. Later this instance could be obtained via
tcpRouter(java.util.UUID) method.
cfg - Router configuration.org.gridgain.grid.GridException - If router start failed.public static void stopHttpRouter(UUID httpRouterId)
httpRouterId - Router identifier to close.@Nullable public static GridHttpRouter httpRouter(UUID id)
id - Router Id.null if router not found.public static Collection<GridHttpRouter> allHttpRouters()
GridHttpRouters.public static void stopAllRouters()