Coming Up for Air

I recently came across an interesting piece of code at work:

private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");

What struck me as odd was the private qualifier and that the fact that SimpleDateFormat is not thread-safe. Is the private some odd attempt to work around concurrency issues, or was thread safety just overlooked? That led me to this question: Is a private staticstill one instance per JVM, or does the private actually change anything? My understanding was that this was a bug, but I thought I'd write a test just to make sure.

On Monday, July 13, I will be leading the monthly OKC JUG session, whose topic this month is "An Introduction to Programming with Minecraft Mods". We'll be using a modified version of the curriculum Arun Gupta has developed for this Devoxx4Kids program, with examples taken from the book he and his son wrote, http://amzn.to/1Jpwz0j[Minecraft Modding with Forge: A Family-Friendly Guide to Building Fun Mods in Java].

Here is the announcement sent to the Oklahoma City tech community. If you're in the area, come check it out!

My team at work was having some issues with IDEA and the Checkstyle plugin. Based on the error message, and without actually looking at the JARs, it seemed pretty clear that the issue was a JDK version issue. While I think this issue has been resolved, when I set up my Mac months ago, I was forced to install Java 6 in order to install IDEA, but, apparently, the new version of the Checkstyle plugin was compiled with a newer JDK (as it should be). Whether or not the Java 6 issue still exists with IDEA, you can make IDEA run on Java 8 pretty easily, and I'll show you how to do it.

Recently, in the #glassfish channel on Freenode, a user was having trouble configuring GlassFish in a Docker environment. He was scripting the configuration of the server, but was having trouble setting the admin user's password, since the change-admin-password command takes input from stdin. Fortunately, there's REST API for that. This curl command will do what the user needs to do without any need for additional input:

curl  -X POST \
    -H 'X-Requested-By: YeaGlassFish' \
    -H "Accept: application/json" \
    -d id=admin \
    -d AS_ADMIN_PASWORD=password \
    -d AS_ADMIN_NEWPASSWORD=password2 \
    http://localhost:4848/management/domain/change-admin-password

Once the password is set, this same command can be used to change the password, but --user admin:$PASSWORD must be added to authenticate the request.

I should note that I don't think this is an officially supported way to execute asadmin commands. It works, but it may change, or it may go away. I would say that Oracle may not support doing this either, but they don't offer any support, so there's no harm there. :) Also note thatAS_ADMIN_PASWORD has a typo in it that may be fixed in future releases of the server. Caveat emptor! :)

Search

Quotes

Sample quote

Quote source

About

My name is Jason Lee. I am a software developer living in the middle of Oklahoma. I’ve been a professional developer since 1997, using a variety of languages, including Java, Javascript, PHP, Python, Delphi, and even a bit of C#. I currently work for Red Hat on the WildFly/EAP team, where, among other things, I maintain integrations for some MicroProfile specs, OpenTelemetry, Micrometer, Jakarta Faces, and Bean Validation. (Full resume here. LinkedIn profile)

I am the president of the Oklahoma City JUG, and an occasional speaker at the JUG and a variety of technical conferences.

On the personal side, I’m active in my church, and enjoy bass guitar, running, fishing, and a variety of martial arts. I’m also married to a beautiful woman, and have two boys, who, thankfully, look like their mother.

My Links

Publications