Source:
<code>protected TransactionStatus executeWork(TransactionType nextTransaction) throws UserAbortException, SQLException { Flat z_users = new Flat(this.rng(), 1, this.num_users); Zipf z_pages = new Zipf(this.rng(), 1, this.num_pages, WikipediaConstants.USER_ID_SIGMA); Class<? extends Procedure> procClass = nextTransaction.getProcedureClass(); boolean needUser = (procClass.equals(AddWatchList.class) || procClass.equals(RemoveWatchList.class) || <START> procClass.equals(GetPageAuthenticated.class)); <END> int userId; do { if (this.rng().nextInt(100) < WikipediaConstants.ANONYMOUS_PAGE_UPDATE_PROB) { userId = WikipediaConstants.ANONYMOUS_USER_ID; } else { userId = z_users.nextInt(); } } while (needUser && userId == WikipediaConstants.ANONYMOUS_USER_ID); int page_id = z_pages.nextInt(); Random rand = new Random(); String pageTitle = WikipediaUtil.generatePageTitle(rand, page_id); int nameSpace = WikipediaUtil.generatePageNamespace(rand, page_id); try{ if (procClass.equals(AddWatchList.class)) { assert(userId > 0); addToWatchlist(userId, nameSpace, pageTitle); } else if (procClass.equals(RemoveWatchList.class)) { assert(userId > 0); removeFromWatchlist(userId, nameSpace, pageTitle); } else if (procClass.equals(UpdatePage.class)) { updatePage(this.generateUserIP(), userId, nameSpace, pageTitle); } else if (procClass.equals(GetPageAnonymous.class)) { getPageAnonymous(true, this.generateUserIP(), nameSpace, pageTitle); } else if (procClass.equals(GetPageAuthenticated.class)) { assert(userId > 0); getPageAuthenticated(true, this.generateUserIP(), userId, nameSpace, pageTitle); } conn.commit(); }catch(SQLException esql) { LOG.error("Caught SQL Exception in WikipediaWorker for procedure"+procClass.getName()+":"+esql, esql); throw esql; } return (TransactionStatus.SUCCESS); }</code><technical_language>Formatting! Andy **hates** tabs</technical_language>

Target:
protected TransactionStatus executeWork(TransactionType nextTransaction) throws UserAbortException, SQLException { Flat z_users = new Flat(this.rng(), 1, this.num_users); Zipf z_pages = new Zipf(this.rng(), 1, this.num_pages, WikipediaConstants.USER_ID_SIGMA); Class<? extends Procedure> procClass = nextTransaction.getProcedureClass(); boolean needUser = (procClass.equals(AddWatchList.class) || procClass.equals(RemoveWatchList.class) || procClass.equals(GetPageAuthenticated.class)); int userId; do { if (this.rng().nextInt(100) < WikipediaConstants.ANONYMOUS_PAGE_UPDATE_PROB) { userId = WikipediaConstants.ANONYMOUS_USER_ID; } else { userId = z_users.nextInt(); } } while (needUser && userId == WikipediaConstants.ANONYMOUS_USER_ID); int page_id = z_pages.nextInt(); String pageTitle = WikipediaUtil.generatePageTitle(this.rng(), page_id); int nameSpace = WikipediaUtil.generatePageNamespace(this.rng(), page_id); try { if (procClass.equals(AddWatchList.class)) { assert (userId > 0); this.addToWatchlist(userId, nameSpace, pageTitle); } else if (procClass.equals(RemoveWatchList.class)) { assert (userId > 0); this.removeFromWatchlist(userId, nameSpace, pageTitle); } else if (procClass.equals(UpdatePage.class)) { this.updatePage(this.generateUserIP(), userId, nameSpace, pageTitle); } else if (procClass.equals(GetPageAnonymous.class)) { this.getPageAnonymous(true, this.generateUserIP(), nameSpace, pageTitle); } else if (procClass.equals(GetPageAuthenticated.class)) { assert (userId > 0); this.getPageAuthenticated(true, this.generateUserIP(), userId, nameSpace, pageTitle); } this.conn.commit(); } catch (SQLException esql) { LOG.error("Caught SQL Exception in WikipediaWorker for procedure" + procClass.getName() + ":" + esql, esql); throw esql; } return (TransactionStatus.SUCCESS); }