Class GridRouterFactory
- java.lang.Object
-
- org.apache.ignite.internal.client.router.GridRouterFactory
-
public final class GridRouterFactory extends Object
This factory is responsible for router lifecycle management. All router should be started, accessed and stopped through this factory.Embedding router
You can useGridTcpRouterConfigurationto set configuration parameters and pass them tostartTcpRouter(GridTcpRouterConfiguration).See
GridTcpRouterfor example on how to configure and start embedded router.Standalone router startup
Alternatively you can run routers as a standalone processes by executingIGNITE_HOME/bin/igniterouter.shorIGNITE_HOME/bin/igniterouter.bat. They both accept path to a configuration file as first command line argument. SeeIGNITE_HOME/config/router/default-router.xmlfor configuration example.- See Also:
GridTcpRouter
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Collection<GridTcpRouter>allTcpRouters()Returns collection of all currently running TCP routers.static GridTcpRouterstartTcpRouter(GridTcpRouterConfiguration cfg)Starts a TCP router with given configuration.static voidstopAllRouters()Stops all currently active routers.static voidstopTcpRouter(UUID tcpRouterId)Stops particular TCP router.static @Nullable GridTcpRoutertcpRouter(UUID id)Returns TCP router with the given id.
-
-
-
Method Detail
-
startTcpRouter
public static GridTcpRouter startTcpRouter(GridTcpRouterConfiguration cfg) throws IgniteCheckedException
Starts a TCP router with given configuration.Starting router will be assigned a randomly generated UUID which can be obtained by
GridTcpRouter.id()method. Later this instance could be obtained viatcpRouter(java.util.UUID)method.- Parameters:
cfg- Router configuration.- Returns:
- Started router.
- Throws:
IgniteCheckedException- If router start failed.
-
stopTcpRouter
public static void stopTcpRouter(UUID tcpRouterId)
Stops particular TCP router.- Parameters:
tcpRouterId- Id of the router to stop.
-
tcpRouter
@Nullable public static @Nullable GridTcpRouter tcpRouter(UUID id)
Returns TCP router with the given id.- Parameters:
id- Router Id.- Returns:
- Router with the given id or
nullif router not found.
-
allTcpRouters
public static Collection<GridTcpRouter> allTcpRouters()
Returns collection of all currently running TCP routers.- Returns:
- Collection of currently running
GridTcpRouters.
-
stopAllRouters
public static void stopAllRouters()
Stops all currently active routers.
-
-