Wednesday, May 03, 2006

Java Lock class is great for test casing

OK, so while trying to understand Oracle's redo latching mechanisms (we have been experiencing a nightmare with log file sync since switching to a new DMX subsystem), I found that java 1.5 has a new Lock class. How cool is that?!!!

import java.io.*;
import java.util.concurrent.locks.*;

class MyThread implements Runnable {
static Lock l = new ReentrantLock();
Thread thrd;

MyThread(String name){
thrd = new Thread(this, name);
thrd.start(); // start the thread
}

public void run(){
System.out.println(thrd.getName() + " starting.");
try {
boolean b = l.tryLock(10000,java.util.concurrent.TimeUnit.MILLISECONDS);
if (b)
System.out.println("Got the lock for " + thrd.getName());
else
System.out.println("Didn't get the lock for " + thrd.getName());
//l.lock();
Thread.sleep(2000);
l.unlock();
}
catch(Exception e) {}
System.out.println(thrd.getName() + " terminating.");
}
}

class myLock {
public static void main(String args[]) {
for (int j = 1; j <= Integer.parseInt(args[0]); j++) {
MyThread mt1 = new MyThread("Child #" + j);
}
}
}

Monday, March 13, 2006

We are all spinning our wheels, trying to use formulas to predict troublespots, when we should be asking basic questions that we do in everyday life. An example is a dad or mom with his/her child. Do we write scripts, or use software to tell us if our kids need help in a given area, or do we talk to them? I realize that a DBA cannot talk to 15,000 different user’s of a system on a daily basis, but it would benefit them (and their users) to ask key users questions about how they use the system. Don’t just look for latch free wait events. Ask the users what they are trying to accomplish. Problems are much easier to solve when we understand the environment in which they have been created...

Wednesday, February 08, 2006

Hello!

This is my first entry to the blog history of building appcrawler, an open source application that will allow you to examine your database applications from an artificial intelligence standpoint. It is an ambitious goal, but I have wanted to do it for a long time, and like they always say, "A journey of a thousand miles begins with one step..."
Locations of visitors to this page