I recently found the original JGroups patent
Month: June 2020
Infinispan/JDG Quickstarts Pt5 – Java HotRodAll
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.
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(builder.build());
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
– 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.
java.io.Console reading is faster than
Mocking request httpAll
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 launcherAll
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.
Using this setting will help to set the JVM properties.
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 java.security 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.
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.
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=”https://phet.colorado.edu/sims/circuit-construction-kit” 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
- The main class to be executed is set with <application-desc main-class>
- 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