Java Code Examples for com.google.appengine.api.backends.BackendServiceFactory#getBackendService()
The following examples show how to use
com.google.appengine.api.backends.BackendServiceFactory#getBackendService() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BackendsApiServlet.java From appengine-java-vm-runtime with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse res) throws IOException { BackendService backends = BackendServiceFactory.getBackendService(); String server = req.getParameter("server"); PrintWriter writer = res.getWriter(); if (server == null) { String currentServerName = backends.getCurrentBackend(); if (currentServerName == null) { currentServerName = "<default>"; } int currentInstance = backends.getCurrentInstance(); writer.append(currentInstance + "." + currentServerName + "\n"); } else { String instance = req.getParameter("instance"); if (instance != null) { writer.append(backends.getBackendAddress(server, Integer.parseInt(instance)) + "\n"); } else { writer.append(backends.getBackendAddress(server) + "\n"); } } }
Example 2
Source File: JobRecord.java From appengine-pipelines with Apache License 2.0 | 5 votes |
private static String getCurrentBackend() { if (Boolean.parseBoolean(System.getenv("GAE_VM"))) { // MVM can't be a backend. return null; } BackendService backendService = BackendServiceFactory.getBackendService(); String currentBackend = backendService.getCurrentBackend(); // If currentBackend contains ':' it is actually a B type module (see b/12893879) if (currentBackend != null && currentBackend.indexOf(':') != -1) { currentBackend = null; } return currentBackend; }
Example 3
Source File: ServersStartServlet.java From appengine-java-vm-runtime with Apache License 2.0 | 4 votes |
@Override public void init() { backendService = BackendServiceFactory.getBackendService(); }