take a look at Doug Lea's books... they are fairly old now (unless he released a new one, not sure), but the concurrent package added in 1.5 is based on his threading libraries. as far as i am concerned, he is the authority on concurrent programming in java... his books will give you the basics of what you need to understand to accomplish this task.
i can only assume this is an academic exercise... if not, i would strongly recommend you stick to the concurrent package as it is well-tested and well-developed... don't re-invent the wheel. good luck.