Guest User

Untitled

a guest
Jun 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. private Set<Integer> getDefaultItemIds( Integer gender ) throws MtvException {
  2. Element inventoryElement = inventoryCache.get( gender );
  3.  
  4. UserInventory defaultInventory = null;
  5. if ( inventoryElement == null || inventoryElement.isExpired( ) ) {
  6. logger.debug( "Default inventory has expired. Retrieving new inventory from the MPPS server." );
  7. try {
  8. defaultInventory = mtvIntegrationUtil.getDefaultInventory( gender );
  9. inventoryElement = new Element( gender, defaultInventory );
  10. inventoryCache.put( inventoryElement );
  11. } catch ( MtvException e ) {
  12. logger.debug( "An exception was thrown getting the default inventory. put something in the cache so it doesnt block" );
  13. inventoryElement = new Element( gender, new UserInventory() );
  14. inventoryElement.setTimeToLive( 1 );
  15. inventoryCache.put( inventoryElement );
  16. throw e;
  17. }
  18. } else {
  19. logger.debug( "Default inventory has not expired. Using cached data" );
  20. defaultInventory = (UserInventory) inventoryElement.getValue( );
  21. }
Add Comment
Please, Sign In to add comment