design pattern: factory pattern.
update: java notes, sychronized.