Friday, April 28, 2017

WebLogic EJB call timeout

If you get often this type of stuck threads:

"[STUCK] ExecuteThread: '170' for queue: 'weblogic.kernel.Default (self-tuning)'" daemon prio=10 tid=0x00002b4f841f1b20 nid=0x5763 in Object.wait() [0x00002b4f8c842000]
   java.lang.Thread.State: WAITING (on object monitor)
 at java.lang.Object.wait(Native Method)
 - waiting on <0x0000000776826778> (a weblogic.rjvm.ResponseImpl)
 at weblogic.rjvm.ResponseImpl.waitForData(
 - locked <0x0000000776826778> (a weblogic.rjvm.ResponseImpl)
 at weblogic.rjvm.ResponseImpl.getTxContext(
 at weblogic.rjvm.BasicOutboundRequest.sendReceive(
 at weblogic.rmi.internal.BasicRemoteRef.invoke(

you might want to set these 2 parameters (this for WLS 10.3.6 )

The reason of that WAITING is that there is a synchronized block followed by an Object.wait(timeout):

  private void waitForData()
    int i = 0;
    synchronized (this)
      long l1 = this.timeout;
      while (!isAvailable()) {
          int j = 0;
          long l2 = System.currentTimeMillis();
          if (this.timeout > 0)
            long l3 = System.currentTimeMillis() - l2;
            if (l3 >= l1) {
              j = 1;
            } else {
              l1 -= l3;
          if ((!isAvailable()) && (j != 0))
            this.t = new RequestTimeoutException("RJVM response from '" + this.rjvm + "' for '" + ( != null ? : "null") + "' timed out after: " + this.timeout + "ms.");
            i = 1;
        catch (InterruptedException localInterruptedException) {}
    if (i != 0) {

See also:
Oracle Support doc "JNDI Thread Stuck" (Doc ID 1482310.1)
For alternative ways to specify timeouts in WLS 12 , see
In WLS 10, use remote-client-timeout in your weblogic.ejb-jar.xml
The Timeout event will cause a RequestTimeoutException which is a IOException : See also Oracle Support article "How to configure timeout for an EJB Client (Doc ID 943282.1)"

in a nutshell:
-Dweblogic.rmi.clientTimeout=timeoutinmilliseconds sets the timeout on the client (consumer) side
remote-client-timeout in weblogic-ejb-jar.xml sets the timeout on the server (provider) side.

Saturday, April 15, 2017

Oracle certified professional Java SE 8 Programmer exam 1z0-809

I recommend buying this book, the examples are very clear and concepts are clearly exposed
For more resources to prepare the exam, see

Saturday, April 8, 2017

Support Global Transactions

For a non-XA Datasource, you can choose to "Support Global Transactions" or not:

In the first case you get <global-transactions-protocol>None</global-transactions-protocol>
in the second case <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol>

Friday, April 7, 2017

Happy third world war to everybody

Meanwhile I suggest you to google for:
false flag
USS Maine
Pearl Harbor
just to name a few...

For those who understand German or Italian, Daniele Ganser explains why NATO helps Terrorists in Syria (it's about gas and oil as usual)

But of course there is no need to worry about reality, the magic virtual World of IT will provide refuge to all geeks.

Saturday, April 1, 2017

Brilliant Java8 tutorial by mkyong
I will recap here the salient points.
mkyong analyzes the use of a Functional Interface In a nutshell:
Collections have a sort method using a comparator, which can be a lambda expression (list of named parameters in (params), -> and the method implementation:
List<Developer> listDevs;
listDevs.sort((Developer o1, Developer o2)->o1.getAge()-o2.getAge());

collections have a forEach method, using also a lambda (a Map has a special forEach)
List<Developer> listDevs;

Map<String, Integer> items;
items.forEach((k,v)->System.out.println("Item : " + k + " Count : " + v));

actually it's not even necessary to declare the type of the parameters, the compiler can infer them from the List type:

listDevs.sort((o1, o2)->o1.getAge()-o2.getAge());

and of course you can assign the Comparator lambda to a variable:
Comparator<Developer> salaryComparator = (o1, o2)->o1.getSalary().compareTo(o2.getSalary());

A Collection can be turned into a stream and filtered
List<String> items;>s.contains("B")).forEach(System.out::println);

and of course you can turn the result of "stream().filter()" into a Collection using collect():

List<String> result = -> !"mkyong". equals (line)).collect(Collectors.toList()); 

To return the first match in a filter (and null if not found) there is a compact way:

Person result = -> "michael".equals(x.getName())).findAny().orElse(null);

You can map on the fly each collection element into a String, using "map()":

String name = -> "michael".equals(x.getName())).map(Person::getName).findAny().orElse("");

One can also perform "group by" on a Stream, just like in SQL (the syntax is a bit obscure, honestly):

Map<String, Long> result =, Collectors.counting()));

this is well documented here

You can create a stream directly, then convert it to a List:
Stream<String> language = Stream.of("java", "python");
List<String> myList = language.collect(Collectors.toList())

same with an array:
Stream<String> stream1 =;

well, in the long run it becomes quite tedious, all this collection manipulation...

Very cool is the java.util.Optional