SCTP Protocol



Stream Control Transmission Protocol, or SCTP, this is very well explained in Video explaining, by Russell DeLong.

Basically, is a protocol sending streams of data between two points, with a connection previously done, and is also called TCPing.

One of the usages of SCTP, is VoIP particularly to support the telephone system’s Signaling System 7 – SS7, together with voice . SCTP also is intended to make it easier to manage connections over a wireless network and to manage the transmission of multimedia data.

SCTP is a standard protocol (RFC 2960) developed by the Internet Engineering Task Force (IETF).

Similarities with TCP:

1. SCTP manages “reliable transport” (ensuring the complete arrival of data units that are sent over the network) over the Internet’s basically connectionless Internet Protocol (IP), the protocol responsible for moving the data but not for managing whether all the data arrives.

Differences with TCP

2. SCTP ensures the complete concurrent transmission of several streams of data (in units called messages) between connected end points. SCTP also supports multihoming, which means that a connected end point can have alternate IP addresses associated with it in order to route around network failure or changing conditions.

In Java

In Java we have the `com.sun.nio.sctp` that implements SCTP.

import java.util.*;
import java.nio.*;
import com.sun.nio.sctp.*; <---- sctp

public class SctpExample
	public static void main(String[] args) throws Exception {
         //Server Channel:
		com.sun.nio.sctp.SctpServerChannel sc =; // Open the channel
		com.sun.nio.sctp.SctpChannel rc = null;
		InetSocketAddress localAddr = new InetSocketAddress (InetAddress.getByName (args[0]), Integer.parseInt (args[1]));
         // Server Channel Open; //Open
		sc.bind(localAddr); //Bind the local address
		sc.close(); //Close

JNI in Java AND Testing JNI with a few GCs



Although I did some stuff with JNI in Java during my time in schooling, I never wrote it about it here. Nor gave examples.


Java Native Interface is used basically for C/C++ interfaces, in my example, I was doing the processing of some data in Java but the data was generated (compiled, traced, generated) in C/C++ (where I would collect the data as well). (Btw, it is just me or this new way to write in wordpress with blocks sucks, like really)

That being said, the quickest example with JNI is by doing in a JAVA class

public class JNIExample{  //
   static {
   private native void sayHello();
   public static void main(String[] args) {
      new HelloJNI().sayHello(); 

After creating the file, we compile it:

fdemeloj@fdemeloj jni]$ javac 

Then create the header with javah, and not javac -h as used to be back in Poly times. Write a HelloWorld.c:

#include <jni.h> //import jni header
#include <stdio.h> //Import the stdio
#include "HelloWorld.h" //Insert the header
Java_HelloWorld_print(JNIEnv *env, jobject obj)
     printf("Hello World!\n");

Write a Make file to make the compilation process easy for our Shared library

	@echo "Generating Shared Library"
	cc -I. -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux -fPIC -shared -o HelloWorld.c HelloWorld.h

	@echo "Cleaning the generated SH files"
	rm *.so

To run the code, just run java (no need for LD_LIBRARY_PATH if you are using -Djava.library.path=.)

[fdemeloj@fdemeloj jni]$ java HelloWorld 
Hello World!

The cool thing is, IT is a shared library totally independent from the JAVA implementation (tcharam, that’s JNI), so then if we want to change the library to this:

 Java_HelloWorld_print(JNIEnv *env, jobject obj)
     printf("After change!\n");

Just recompile the shared library with Make clean;Make. and It’s all good:

[fdemeloj@fdemeloj jni]$ java HelloWorld 
After change!

Next thing is to test the GC collections with JNI, from this link. From the same process, we run Makefile, that takes the java and compile it.

#include <jni.h>
#include <CriticalGC.h>

static jbyte* sink;

JNIEXPORT void JNICALL Java_CriticalGC_acquire(JNIEnv* env, jclass klass, jintArray arr) {
   sink = (*env)->GetPrimitiveArrayCritical(env, arr, 0);

JNIEXPORT void JNICALL Java_CriticalGC_release(JNIEnv* env, jclass klass, jintArray arr) {
   (*env)->ReleasePrimitiveArrayCritical(env, arr, sink, 0);

Running it with Shenandoah we see the difference and how it is so fast:

[fdemeloj@fdemeloj critical-gc]$ make run-shenandoah 
time java -Djava.library.path=. -Xms4g -Xmx4g -verbose:gc -XX:+UseShenandoahGC CriticalGC
[Pause Init Mark, 0.533 ms]
[Concurrent marking 2880M->2988M(4096M), 216.052 ms]
[Pause Final Mark 2988M->920M(4096M), 2.220 ms]
[Concurrent reset bitmaps 922M->926M(4096M), 0.946 ms]
^CCancelling concurrent GC: Stopping VM

I mean, comparing with the other GC’s approaches this Shenandoah doesn’t even stop.


Following this reference

PodCast `Hora do Lancamento`


Hora do Lancamento

Gabriel Alabarse and me, we started a podcast to talk about some of the launches that currently happen: basically SpaceX and RocketLab. We are trying to fight the HUGE amount of MISINFORMATION there is around, particularly in Youtube in Portuguese. Abnormal amount. Big channels, with millions of views spreading conspirational theories.

The explanation for being in Portuguese more than English, is because we have several very good channels that explain the basics for the general population in English, examples: Everyday Astronaut, SpaceXcentric, Scott Manley, 2 The Future Together, SpaceXfans, and the Angry Astronaut, besides the launches from SpaceX, ULA, RocketLab, all content in English.

It is just the first try:


Infinispan/JDG Quickstarts Pt5 – Java HotRod



Another Hot Rod tutorial, this time with java, similar concept but using a Hot Rod java client. Just a reminder, basically TCP client that access the cache on JDG.

Core part

There is the `​FootballManager` and the Team, which are pretty much the classes that play a role here (except for the user). So then a FootballManager has team(s) and so forth. The team just encapsulates the list of players and the name. The core part (talking with the cache itself) is on the FootballManager class.

ConfigurationBuilder builder = new ConfigurationBuilder();
cacheManager = new RemoteCacheManager(;
cache = cacheManager.getCache(“teams”);

The main part is then the builder adding the server with jdgProperty (from a file) and the port. Then it adds the players. The file has basically the host and the port:

To read the commands,  it is used in comparison with the javascript version (that uses Vorpalo=||==>).

Interesting Topics

– Originally the players added were Messi, Pedro, and Puyol. I changed for Pele, Tostao, and Rivelino (Tri-world champions on the1970th World Cup in Mexico)

– Comparing with the JS version: This version is done in Java,that’s the only difference. Although js has a simpler connection with JDG.

– Interestingly, reading is faster than bufferedReader




Mocking request http



Recently I needed to simulate some requests http so then I used EasyMock. Quite useful indeed and very simple:


HelloServletMock mock = new HelloServletMock();

HttpServletRequest request = createMock(HttpServletRequest.class);
HttpServletResponse response = createMock(HttpServletResponse.class);

expect(request.getParameter(“yourName“)).andReturn(“Jose Carlos“).times(1, 2);

On this case the request will return “Jose Carlos” when I get the paramter “yourName”, example:

String yourName = request.getParameter(“yourName”);

Icedtea-web ~ jnlp launcher



As replacement for Java Web Start, IcedTea-web, provides a Java Web browser plugin. What I like about this project is that it is so clean, easy to access, easy to execute some Java Network Launch Protocol files.


Control Panel


Iced Tea Web – Control Panel

JVM Settings

Using this setting will help to set the JVM properties.

Policy Settings

This basically is a link to the java.policy:

[$JAVA_HOME/jdk1.8.0_191]$ cd jre/lib/security/
[fdemeloj@fdemeloj security]$ ls
blacklist blacklisted.certs cacerts java.policy javaws.policy policy trusted.libraries

         Extended applet security

So here one can add the exceptions, in a similar way to JWS. So then you edit the rows in order to add the site exception.

IcedTea-Web Tests/Samples

On the link you can select the test to be done, the tests are .jnlp files that you execute directly clicking on it (of course, the default will be IcedTea-web) so we open. This one is pretty cool: circuit-construction-kit-dc_en.jnlp – Developed by PhET at the University of Colorado.


IcedTea test – circuit construction

The code is pretty straightforward, is jnlp file:

You will have a XML file with:

                    1. code base link (to fetch),

                    2.a jar file (to execute),

                    3. some properties – language for example

<?xml version=”1.0″ encoding=”utf-8″?>

<!– JNLP File for Circuit Construction Kit (DC Only) –>

<jnlp spec=”1.0+” codebase=”” href=”circuit-construction-kit-dc_en.jnlp”>

<property name=”javaws.phet.locale” value=”en” />
<property name=”javaws.user.language” value=”en” />

<jar href=”circuit-construction-kit_all.jar”/> ii


<application-desc main-class=”edu.colorado.phet.circuitconstructionkit.CircuitConstructionKitDCApplication“>



  1. The main class to be executed is set with <application-desc main-class>
  2. Interestingly they have this application for several languages, including Korean and Portuguese! It is possible to change the language by changing the property <property name=”javaws.phet.locale” value=”LANGUAGE” /> AND the doc circuit-construction-kit-dc_es.jnlp. And yes, Ampolleta means light in Spanish.

The tags and meaning of them can be found in JNLP Syntax



OOB messages



I’m using this new block scheme in Word Press, and I can say: I suck on this. Like totally, I don’t know where do to anything. Totally, is like learning a new language, I know nothing about it. But does not seem that bad, in fact.

OOB Messages

Out Of Band messages – are sent periodically from the members. Is a message with a tag Message.OOB and is processed by a specific thread pool: out-of-band thread pool at the receiver’s side and they are handled at the transport level.

Message msg=new Message();
msg.setFlag(Message.OOB, Message.NO_FC);

Configuration of the oob thread pool:

    public Executor getOOBThreadPool()

    public void setOOBThreadPool(Executor oob_thread_pool)

Removing OOB Thread Pool

For simplicity, JGroups ended up removing OOB Thread Pool, which was combined with the regular thread pool, reducing the number of thread pools in JGroups 4. This means the configuration above, for oob thread pool, becomes obsolete and the new configuration is done as follows:




Quick servlet



Gonna show how to do a small servlet here.


Basically the main part is to extend HttpsServlet

public class StarterServlet extends HttpServlet {

private static final long serialVersionUID = 1L;

public void init(ServletConfig servletConfiguration) throws ServletException {


System.out.println(“SERVLET STARTED!”);

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


PrintWriter printWriter = response.getWriter();

printWriter.println(“Hello world”);

Creating the war file

jar -cvf myapp.war *


cp myapp.war /home/fdemeloj/jboss-eap-7.3/standalone/deployments

Accessing it


Linkedin Social Selling Index


Heads up

Linkedin has an index of social influence, is called SSI. Basically is how much you impact your social network – SSI. Although I usually don’t care much about index in social media, this one might be relevant since it is related to work career.

How is calculated

Basically is a sum of the 4 items:

  • Establish your professional brand (1-25)

  • Find the right people (1-25)

  • Engage with insights (1-25)

  • Build relationships (1-25)

How to improve your Social Selling Index:

There is a presentation about this directly from Linkedin.