During a recent period of high traffic level on our site, we found we had several threads blocked on a particular component. We found that the component contained a synchronized block of code, which means only one request can be…
Category: Java
Inserting full objects into a database column
I have never seen the need for this, but I like to understand things in case I ever run across them “in the wild”. I did see it in a commercial ecommerce application in which the designers serialized an “Order”…
Cloudera Impala simple command line test
I am a big believer in simple command line examples. Connecting the dots is so much easier when you do this. There will be much more on this, but this should get you started. CLASSPATH is shown below. The absolute…
Querying Hive from Tomcat
Below is a very simple example to get started on how Hive can be queried from a web front end. The idea behind this would be to present the user with a csv file mime type that would be opened…
Querying Hadoop from Tomcat
Below is a very simple example for how to print in Tomcat the contents of a file stored in HDFS. I am not entirely sure where this would be useful, for the following reasons: * Unless you have a list…
Query facebook posts using RestFB
import com.restfb.*; import com.restfb.types.*; import com.restfb.json.*; import com.restfb.util.*; import com.restfb.FacebookClient.*; import java.net.*; import java.io.*; import java.util.*; import org.json.simple.*; import org.json.simple.parser.*; public class fbLogin { public static void main(String args[]) { AccessToken accessToken = new DefaultFacebookClient().obtainAppAccessToken(“153104261535601″,”5f7acbbe49a0fcd29afe0280d4dadc6c”); System.out.println(accessToken.getAccessToken()); //User user = facebookClient.fetchObject(“me”,…
HDFS – Where are my file blocks?
At times I would like to know how a file is stored in HDFS. What is below will show which blocks exist for a given file, as well as on which nodes they are stored. import java.io.*; import java.util.*; import…
Formatting garbage collection output with timestamps
If you are running a version of java where -XX:+PrintGCDateStamps is not honored, you can run what is below. For those that are unaware, by default garbage collection will print the seconds since the JVM process started. In the heat…
Does hadoop/HDFS distribute writes to all data nodes on ingest?
I like simple, command line test cases. Lather, rinse, repeat (do any shampoo bottles actually have that anymore 🙂 ?) I wanted to ensure I could prove that ingests to hadoop actually didn’t send everything through the name node, which…
One way to tell if a thread pool is hung
A hung ThreadPoolExecutor in java can be manifested in various ways. At least one, that I wanted to post for my own notes, is below. A thread dump may show something like what is below: “pool-9-thread-5” prio=6 tid=0x01b84400 nid=0x16e0 waiting…