protected class WorkItem { private CommandType commandType; String command; public WorkItem(CommandType commandType, String command) { this.commandType = commandType; this.command = command; } /** * Execute the WorkItem * */ public void exec() { switch(commandType) { case CONNECT: // connection stuff here break; case DISCONNECT: // disconnect stuff here break; } } }