Deploying a GAE Application

 Cloud  Comments Off on Deploying a GAE Application
May 312015

In this post, we’ll describe how to deploy an application to Google App Engine.

The first step in deploying an application require that you create a Google developer account. To start th process of registering an application ID, follow this link: For that, you will need to have previuosly a Google Account or have a Google Apps account. In the latter option, you will have to use the link<YOURDOMAIN.COM>/, where YOURDOMAIN.COM is replaced with your actual Google Apps domain name.
Continue reading »

Timer versus ScheduledThreadExecutor

 Sin categoría  Comments Off on Timer versus ScheduledThreadExecutor
May 132015

According to Java Concurrency in Practice and other sources of information main differences between Timer and ScheduledThreadExecutor are:

  • Timer can be sensitive to changes in the system clock, ScheduledThreadPoolExecutor isn’t
  • Timer has only one execution thread, so long-running task can delay other tasks. ScheduledThreadPoolExecutor can be configured with any number of threads. Furthermore, you have full control over created threads, if you want (by providing ThreadFactory)
  • Runtime exceptions thrown in TimerTask kill that one thread, thus making Timer dead :-( … i.e. scheduled tasks will not run anymore. ScheduledThreadExecutor not only catches runtime exceptions, but it lets you handle them if you want (by overriding afterExecute method from ThreadPoolExecutor). Task which threw exception will be canceled, but other tasks will continue to run.


ScheduledExecutorService ex= Executors.newSingleThreadScheduledExecutor();

will give you a ScheduledExecutorService with similar functionality to Timer (i.e. it will be single-threaded) but whose access may be slightly more scalable (under the hood, it uses concurrent structures rather than complete synchronization as with the Timer class). Using a ScheduledExecutorService also gives you advantages such as:

  • You can customize it if need be (see the newScheduledThreadPoolExecutor() or the ScheduledThreadPoolExecutor class)
  • The ‘one off’ executions can return results
  • You can reschedule the same task inside run method using a ScheduledExecutorService, but not using  a Timer. With Timer you get java.lang.IllegalStateException: Task already scheduled or cancelled