@Override public synchronized void run() { final boolean d = debug.get(); final boolean t = trace.get(); if (this.first) { Thread self = Thread.currentThread(); self.setName( HStoreThreadManager.getThreadName(hstore_site, HStoreConstants.THREAD_NAME_HELPER)); hstore_site.getThreadManager().registerProcessingThread(); this.first = false; } if (t) LOG.trace("New invocation of the ExecutionSiteHelper. Let's clean-up some txns!"); this.hstore_site.updateLogging(); for (PartitionExecutor es : this.executors) { // if (t) LOG.trace(String.format("Partition %d has %d finished transactions", // es.partitionId, es.finished_txn_states.size())); // long to_remove = System.currentTimeMillis() - this.txn_expire; int cleaned = 0; // while (es.finished_txn_states.isEmpty() == false && (this.txn_per_round < 0 || // cleaned < this.txn_per_round)) { // AbstractTransaction ts = es.finished_txn_states.peek(); // if (ts.getEE_FinishedTimestamp() < to_remove) { //// if (traceLOG.info(String.format("Want to clean txn #%d [done=%s, // type=%s]", ts.getTransactionId(), ts.getHStoreSiteDone(), ts.getClass().getSimpleName())); // if (ts.isHStoreSite_Finished() == false) break; // // if (t) LOG.trace("Cleaning txn #" + ts.getTransactionId()); // // // es.cleanupTransaction(ts); // es.finished_txn_states.remove(); // cleaned++; // this.total_cleaned++; // } else break; // } // WHILE if (d && cleaned > 0) LOG.debug( String.format( "Cleaned %d TransactionStates at partition %d [total=%d]", cleaned, es.getPartitionId(), this.total_cleaned)); // Only call tick here! // es.tick(); } // FOR // Recompute MarkovGraphs if we have them MarkovGraph m = null; while ((m = this.markovs_to_recompute.poll()) != null) { if (d) LOG.debug( String.format( "Recomputing MarkovGraph for %s [recomputed=%d, hashCode=%d]", m.getProcedure().getName(), m.getRecomputeCount(), m.hashCode())); m.calculateProbabilities(); if (d && m.isValid() == false) { LOG.error("Invalid MarkovGraph after recomputing! Crashing..."); Exception error = new Exception( String.format( "Invalid %s MarkovGraph for after recomputing", m.getProcedure().getName())); this.hstore_site.getCoordinator().shutdownCluster(error); } } // WHILE }