public class GraphService extends Object
GraphSource
Modifier and Type | Field and Description |
---|---|
GraphSource.Factory |
graphSourceFactory |
Constructor and Description |
---|
GraphService() |
GraphService(boolean autoReload) |
Modifier and Type | Method and Description |
---|---|
int |
evictAll()
Dissocate all graphs from their router IDs and release references to the graphs to allow
garbage collection.
|
boolean |
evictRouter(String routerId)
Dissociate a router ID from the corresponding graph/services object, and disable that router ID for
use in routing.
|
GraphSource.Factory |
getGraphSourceFactory() |
Router |
getRouter() |
Router |
getRouter(String routerId) |
Collection<String> |
getRouterIds() |
boolean |
registerGraph(String routerId,
GraphSource graphSource)
Blocking method to associate the specified router ID with the corresponding graph source,
load it from appropriate source (serialized file, memory...), and enable its use in routing.
|
boolean |
reloadGraph(String routerId,
boolean preEvict,
boolean force)
Reload a registered graph.
|
boolean |
reloadGraphs(boolean preEvict,
boolean force)
Reload all registered graphs from wherever they came from.
|
static boolean |
routerIdLegal(String routerId)
Check whether a router ID is legal or not.
|
void |
setDefaultRouterId(String defaultRouterId) |
public GraphSource.Factory graphSourceFactory
public GraphService()
public GraphService(boolean autoReload)
public void setDefaultRouterId(String defaultRouterId)
defaultRouterId
- The ID of the default router to return when no one is specifiedpublic Router getRouter() throws GraphNotFoundException
GraphNotFoundException
public Router getRouter(String routerId) throws GraphNotFoundException
GraphNotFoundException
public boolean reloadGraphs(boolean preEvict, boolean force)
public boolean reloadGraph(String routerId, boolean preEvict, boolean force)
routerId
- ID of the routerpreEvict
- When true, release the existing graph (if any) before loading. This will
halve the amount of memory needed for the operation, but routing will be unavailable
for that graph during the load processforce
- When true, force a reload. If false, only check if the source has been modified,
and reload if so.public Collection<String> getRouterIds()
public boolean registerGraph(String routerId, GraphSource graphSource)
public boolean evictRouter(String routerId)
public int evictAll()
public GraphSource.Factory getGraphSourceFactory()
public static boolean routerIdLegal(String routerId)
Copyright © 2019. All rights reserved.