Tag: java

  • Seven performance metrics for Java applications

    by

    in

    I came across this in this blog post and am adding it here as a checklist. It’s a worthwhile list to have so you can understand how your Java app behaves in production. Response times and throughput Load Average Error Rates (and how to solve them) GC rate and pause duration Business Metrics Uptime and service…

  • Switching between multiple Java versions on OS X quickly

    by

    in

    If you’re a Java developer like me, you will need to work on various Java versions. If so, adding the following in your ~./bash_profile makes switching between versions a snap. (As of this writing, I’m running on OS X El Capitan.) alias java6=’export JAVA_HOME=$(/usr/libexec/java_home -v 1.6);java -version’ alias java7=’export JAVA_HOME=$(/usr/libexec/java_home -v 1.7);java -version’ alias java8=’export…

  • How to install jshell via Homebrew

    At the time of this writing, Java 9 is in beta. I installed because I wanted to check out jshell, Java’s new REPL (read-evaluate-print-loop). On top of the below, I brew-installed jenv (a must for managing different JDK versions). $ brew install Caskroom/versions/java9-beta $ jenv add /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home $ jenv shell oracle64-9-ea $ java -version java…

  • Mongo DB: Iterate through a MongoCollection

    This is specifically for Mongo 3.x, where MongoCollection is preferred over DBCollection. Adding for personal archiving. MongoCollection mongoCollection = getMongoCollection(databaseName, collectionName); FindIterable documents = mongoCollection.find(eq(COLUMN, “lastName”)) .sort(ascending(“lastname”)); for (Document document : documents) { … }

  • Cucumber-JVM: Running a @Before step only for certain scenarios

    You can make use Cucumber’s @Before and @After to execute only for certain scenarios like the below. This is especially useful if you, say, wanted to make a (Mongo) DB connection for a few test scenarios. @Before(“@mongo”) public void beforeScenario() { // actions } @After(“@mongo”) public void afterScenario() { // actions } To complete the…