com.google.appengine.api.ThreadManager Java Examples
The following examples show how to use
com.google.appengine.api.ThreadManager.
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: WorkerServlet.java From io2014-codelabs with Apache License 2.0 | 5 votes |
/** * Create App Engine threads that will poll and the process the tasks. */ @Override public void doGet(HttpServletRequest req, HttpServletResponse res) { for (int workerNo = 0; workerNo < NUMBER_OF_WORKERS; workerNo++) { Thread thread = ThreadManager.createBackgroundThread(new Runnable() { @Override public void run() { doPolling(); } }); thread.start(); } }
Example #2
Source File: NotificationCleanupServlet.java From io2014-codelabs with Apache License 2.0 | 5 votes |
@Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { Thread thread = ThreadManager.createBackgroundThread(new Runnable() { @Override public void run() { doCleanup(); } }); thread.start(); }
Example #3
Source File: WorkerServlet.java From solutions-mobile-backend-starter-java with Apache License 2.0 | 5 votes |
/** * Create App Engine threads that will poll and the process the tasks. */ @Override public void doGet(HttpServletRequest req, HttpServletResponse res) { for (int workerNo = 0; workerNo < NUMBER_OF_WORKERS; workerNo++) { Thread thread = ThreadManager.createBackgroundThread(new Runnable() { @Override public void run() { doPolling(); } }); thread.start(); } }
Example #4
Source File: NotificationCleanupServlet.java From solutions-mobile-backend-starter-java with Apache License 2.0 | 5 votes |
@Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { Thread thread = ThreadManager.createBackgroundThread(new Runnable() { @Override public void run() { doCleanup(); } }); thread.start(); }
Example #5
Source File: PushNotificationWorkerServlet.java From solutions-ios-push-notification-sample-backend-java with Apache License 2.0 | 5 votes |
@Override public void doGet(HttpServletRequest req, HttpServletResponse res) { // Create App Engine threads that will poll and the process the tasks. for (int workerNo = 0; workerNo < NUMBER_OF_WORKERS; workerNo++) { Thread thread = ThreadManager.createBackgroundThread(new Runnable() { @Override public void run() { doPolling(); } }); thread.start(); } }
Example #6
Source File: NotificationCleanupServlet.java From solutions-ios-push-notification-sample-backend-java with Apache License 2.0 | 5 votes |
@Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { Thread thread = ThreadManager.createBackgroundThread(new Runnable() { @Override public void run() { doCleanup(); } }); thread.start(); }
Example #7
Source File: ChatSocketServer.java From appengine-websocketchat-java with Apache License 2.0 | 5 votes |
/** * Starts the websocket server, registers necessary information and then starts the bridge * thread. */ public void start() { if (chatSocketServer != null) { throw new IllegalStateException("We already have a chatSocketServer."); } chatSocketServer = new ChatSocketServer(DEFAULT_PORT); chatSocketServer.start(); LOG.info("Server started on port: " + chatSocketServer.getPort()); try { registerWebSocketServerNode(); } catch (IOException e) { LOG.warning(Throwables.getStackTraceAsString(e)); } ThreadManager.createBackgroundThread(this).start(); }
Example #8
Source File: InitializationServlet.java From wt1 with Apache License 2.0 | 5 votes |
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { System.out.println("*********************"); Logger.getRootLogger().removeAllAppenders(); BasicConfigurator.configure(); registerShutdownHook(); /* Load config */ try { File configFile = new File(getServletContext().getRealPath(CONFIG_PATH)); Properties props = new Properties(); props.load(new FileReader(configFile)); props.load(new FileReader(configFile)); ProcessingQueue.getInstance().configure(props); /* Start all processing threads */ for (Runnable runnable : ProcessingQueue.getInstance().getRunnables()) { Thread thread = ThreadManager.createBackgroundThread(runnable); thread.start(); } } catch (Exception e) { throw new IOException("Could not create processing threads", e); } logger.info("App started"); }