Free IT Books, Study Guides, Practice Exams, Tutorials and Software
Saturday, October 03rd 2015
-  Free Books
Free MSDN Mags
Free Oracle Mags
Free software CDs
- Certifications
  Exam Details
  Mock exams
  Study guides
  Exam Details
  Mock exams
  Study guides
  Sample chapters
  Exam Details
  Mock exams
  Study guides
  Sample chapters
  Exam Details
  Mock exams
  Study guides
  Sample chapters
  Exam Details
  Mock exams
  Study guides
  Sample chapters
  Exam Details
  Mock exams
  Study guides
  Sample chapters
  Mock exams
  MCSE guides/exams
  Exam Resources
- Java / J2EE
- .NET
Knowledge Base
  .NET Framework
  Visual Studio.NET
- About
Gayan Balasooriya

Broken links?
Suggest good links
To remove links
 weblogs from Javablogs.com

SQE Project is under active development again.

Good news!

After a long time of silence, active development on the SQE project has started again. The source can be found on https://github.com/sqe-team/sqe.
The SQE project site on kenai will be removed within the near future.

Current Roadmap:
- SQE release for Netbeans IDE 8.1
- Java 8
- Gradle support
- Update used tools to latest versions (FindBugs, PMD, Checkstyle)
- Bugfixing

A practical example using MarkupKit and WebRPC

Following up on my last entry - this article continues the discussion of WebRPC with a practical example. The example simulates a connected air conditioner that can be controlled remotely via an iOS client app. The server-side Java version of WebRPC is used to implement the simulated air conditioner, and MarkupKit is used to create the user interface for the iOS client. The iOS app uses the Objective-C WebRPC client library to communicate with the server:


Introducing WebRPC

It has been a long time since I posted anything on java.net. However, I've been working on a new open-source project recently that may be of interest so I thought I would mention it:


From the project's README:

"WebRPC is a mechanism for executing remote procedure calls via HTTP. It is an intentionally simple protocol that is designed primarily to address common use cases in web service development. Any platform capable of submitting an HTTP request and consuming a JSON response can be a WebRPC client, and any platform capable of responding to an HTTP request and producing a JSON result can act as a WebRPC server."

The project currently provides support for creating services in Java and consuming services in Objective-C, Swift, Java, and JavaScript. Support for other platforms may be added in the future. Contributions are welcome.

This article provides an overview of the project along with sample code demonstrating the implementation of a simple web RPC service in Java. Client examples in Swift, Java, and JavaScript are also provided:


Hope you find it useful!

NetBeans Day in Burkina Faso report

[url=http://www.univ-bobo.bf/spip.php?rubrique9]Ecole Sup

Browsing Your Developer Cloud Service Maven Repository Using Cyberduck

Browsing Your Developer Cloud Service Maven Repository Using Cyberduck

Back from the JCrete Unconference

Some time ago, I got an invitation from Heinz Kabutz (the man behind the Java Specialists newsletter, to which you should subscribe right away if you haven't already), to join the JCrete conference. ?

My wife took a dim view of this.

Developing professional Java application with NetBeans IDE at university

Last saturday, 11th july 2015, I was at Ecole Sup

Managing Concurrency in SIP Servlet 2.0
There are some key differences to programming SIP applications compared to usual Java EE applications, which are mostly based on HTTP. Often SIP Servlets are used to create a service that involve multiple SIP Sessions and SIP Application Sessions. The SIP protocol is much more asynchronous than HTTP and hence SIP Servlet POJOs need to handle many kinds of requests and responses. Both these can lead to a number of scenarios which can cause concurrency issues. Lets look at one such scenario which can cause a deadlock.

As you may see above, there may be situations two threads in an application may access the SIP Application Sessions locked by the other thread. Obviously, this also depends how exactly the container is handling the concurrency. In any case, it is a clear issue in writing portable applications.

SIP Servlet 2.0 introduces two capabilities to solve this issue.

1) A standard concurrency control mode for SIP Servlet Applications.

package com.example;
import javax.servlet.sip.SipServlet;
@SipApplication (name = “Foo”, concurrencyMode =

If you have an annotation like this in your SIP Servlet POJO, then the container performs concurrency control at the level
of the application session. It ensures various tasks that access the application session are not executed at the same time.

2) A set of concurrency utilities for SIP.

Making use of JSR 236 (Concurrency Utilities for JavaTM EE) SIP Servlet 2.0 defined a few concurrency utilities for SIP Servlets. It help SIP Servlet Application to run a task concurrently with a specified SIP Application Session as the context. Note that the general behavior of these utilities are defined by JSR 236. SIP Servlet 2.0 defines the behavior of the specified JNDI objects specific for SIP Servlet Applications.

  • ManagedExecutorService : java:comp/ManagedSipExecutorService
  • ManagedScheduledExecutorService : java:comp/ManagedScheduledSipExecutorService
  • ContextService : java:comp/SipContextService
  • ManagedThreadFactory : java:comp/ManagedSipThreadFactory

Apart from these, the SIP Servlet 2.0 also defines three "execution properties" that allow an application to specify the SIP Application Session to use as the context while running the tasks. See below for the properties.

  • javax.servlet.sip.ApplicationSessionKey : Specifies the SIP application key.
  • javax.servlet.sip.ApplicationSessionId : Specifies the application session
  • javax.servlet.sip.ApplicationSession.create : Indicates that the container creates a new SipApplicationSession and use it as the context.
2.a) Submitting a task with the SIP Application Session of SIP Servlet POJO as the context,

To do this, application do the following.

  1. Inject a java:comp/ManagedSipExecutorService using @Resource annotation
  2. Create a Callable or Runnable that contain the business logic.
  3. submit the Callable or Runnable from the SIP Servlet POJO.

Here is an example code

public class ExamplePOJO1{
  ManagedExecutorService mes;
  protected void onInvite(SipServletRequest req) {
    // Create a task instance. MySipTask implements Callable...
    MySipTask sipTask = new MySipTask();
    // Submit the task to the ManagedExecutorService...
    Future sipFuture = mes.submit(sipTask);
2.b) Submitting a task with a specific SIP Application Session as the context

To do this, application do the following.

  1. Inject a java:comp/ManagedSipExecutorService using @Resource annotation
  2. Create a Callable or Runnable that contain the business logic.
  3. Create a Contextual Proxy object of the Callable or Runnable using the java:comp/SipContextService utility.
  4. submit the Contextual Proxy object.

Here is an example code to explain how this may be done.

@Resource(lookup = "java:comp/SipContextService")
  ContextService sipCS;

  @Resource(lookup = "java:comp/ManagedSipExecutorService")
  ManagedExecutorService sipMES;

  SipSessionsUtil ssu;

  public void doAsync(final String sasId, final String appState) {
    Map props = new HashMap<>();
    props.put(SipServlet.SIP_APPLICATIONSESSION_ID, sasId);

    final SipSessionsUtil util = ssu;

    Runnable task = (Runnable & Serializable) () -> {
      final SipApplicationSession session =
      int counter = (int) session.getAttribute("counter");
      session.setAttribute("counter", ++counter);
      session.setAttribute("appState", appState);

    Runnable proxyTask = (Runnable) sipCS.createContextualProxy
      (task, props, Runnable.class, Serializable.class);

With these capabilities, the application can run the above scenario without concurrency issues.

This is just a snapshot of the functionality being provided. There are a number of advanced capabilities possible. Some of the interesting ones are given below

  1. Use java:comp/ManagedScheduledExecutorService for scheduling tasks instead of TimerService
  2. Run the contextual proxy with specified SIP Application Session as the context directly on a thread (eg: MDB thread) without submitting the task

  3. You may also use a ManagedTask instead of Contextual Proxy.

Sorry for the long article. Hope this helps writing SIP Servlet Applications with better concurrency control and portability.

And we have moved!

And we have moved to https://www.manorrock.com/blog/

Webinar Notes: Typesafe William Hill Omnia Patrick Di Loreto

Webinar Notes: Typesafe William Hill Omnia Patrick Di Loreto

My friend Oliver White is doing his usual bang-up job in his new gig at TypeSafe. One aspect is the humble webinar. Here are my notes for one that caught my eye, Using Spark, Kafka, Cassandra and Akka on Mesos for Real-Time Personalization. This is a very dense but well delivered presentation by Patrick Di Loreto who helped develop a new platform for his employer, the online gambling service, William Hill.

Morally, I am sensitive to the real damage done to real lives and families that is caused by gambling, so I will include a link to an organization that offers help: 1-800-GAMBLER. That said, this is just another instance of the ancient tradition of technology development being driven by something that traditionally is seen as vice. (For a humorous, NSFW and prophetic Onion article, search google for “theonion internet andreessen viewing device”. I’m old enough to have first read that on an actual physical newspaper!)

Now, on to the raw notes. YMMV of course, but if nothing else this will help you overcome the annoying problem of the slide advancing not being synched to the audio.

Context: presentation by Patrick Di Loreto (@patricknoir) R&D
Engineering lead for William Hill online betting.  The presenation was
done for Typesafe as a Webinar on 14 June 2015.

They have a new betting platform they call Omnia.

- Need to handle massive amount of data

- Based on Lambda Architecture from Nathan Marz

- Omnia is a platform that includes four different components

  * Chronos - Data Source

  * Fates - Batch Layer

  * NeoCortex - Speed layer

  * Hermes - Serving layer

03:47 definition of Lambda Architecture 

  “All the data must come from a unique place (data source)

  They separate access to the data source into two different modes based
  on timeliness requirements.

  NeoCortex (Speed Layer) is to access the data in real time, but
  without some consistency and correctness guarantees.  Optimized for
  speed.  It has only recent data.

  Fates (Batch Layer) is to access the data not in real time, but with
  more (complete?) consistency.

05:00 Reactive Manifesto slide

06:15 importance of elasticty for them

06:47 Chronos Data Source: “It’s nothing else than a container for
active streams”

  “Chronos is a sort of middleware.  It can talk to the outside world
  and bring the data into their system.”  Organize the data into a
  stream of observable events, called “incidents”.  Can have different
  viewpoints for different concerns
  * Internal (stuff they need to implement the system itself)

  * Product centric (which of the WH products such as “sports” “tweets”

  * External (“social media sharing”)

  * Customer centric

10:12 Chronos streams connect to the external system and bring it into

  Adapter: Understand all the possible protocols that other systems
  implement.  Connect to the other system.

  Converter: Transform the incoming data into their internal format

  Persistence Manager: Make the converted data durable.

11:22 Chronos clustering

  Benefits from the Akka Framework.

  Distributes the streams across the cluster.

  When failover happens, stream connection to outside source is migrated
  to another node via Akka.  Keeps referential transparency.  Each
  stream is an Actor which “supervises” its children: adapter,
  converter, persistence manager.  

12:41 Supervising (Slides diverged from audio) (Slide 12)

  Supervision is key to allowing “error kernel
  pattern”. <http://danielwestheide.com/blog/2013/03/20/the-neophytes-guide-to-scala-part-15-dealing-with-failure-in-actor-systems.html>

    Basically, it is just a simple guideline you should always try to
    follow, stating that if an actor carries important internal state,
    then it should delegate dangerous tasks to child actors, so as to
    prevent the state-carrying actor from crashing. Sometimes, it may
    make sense to spawn a new child actor for each such task, but that

All brand names,logos and trademarks in this site are property of their respective owners.

-  Free Magazines

Free Magazine
-  News
  Wireless Java
Industry News
  CNET News
  CNET E-Business
  CNET Enterprise
-  Weblogs
James Gosling's
-  Tell A Friend
Tell others
Free eBooks |  About |  Disclaimer |  Terms Of Use |  Privacy Policy
Copyright 2001-2006 Gayan Balasooriya.   
All Rights Reserved.