/** * Add this piece of java code to AnagramsStats java class. * Methods exposed to Anagrams UI components to feed management with data. */ private long startTime; /* * A new Anagram is proposed to the user. User starts thinking... */ public void startThinking() { startTime = System.currentTimeMillis(); } /* * An Anagram has been solved. */ public void stopThinking() { //Update the number of solved anagrams numSolvedAnagrams++; // Compute last thinking time (in seconds). long stopTime = System.currentTimeMillis(); lastThinkingTime = (int) (stopTime - startTime) / 1000 ; //Create JMX Notification to notify Anagram resolution Notification notification = new Notification(AttributeChangeNotification.ATTRIBUTE_CHANGE, this, getNextSeqNumber(), "Anagram solved!"); // Send JMX notification. broadcaster.sendNotification(notification); }