1 51 52 package org.objectweb.jass.examples.travelagency.ejbs.compensations; 53 54 import org.objectweb.jass.examples.travelagency.ejbs.HotelBean; 55 import org.objectweb.jass.examples.travelagency.exceptions.DBException; 56 57 import javax.activity.opennested.Compensator; 58 59 66 public class ReserveRoomsCompensation implements Compensator { 67 HotelBean bean; 68 int rooms; 69 70 75 public ReserveRoomsCompensation(HotelBean hotelBean, int nRooms) { 76 bean = hotelBean; 77 rooms = nRooms; 78 } 79 80 82 85 public void compensate() { 86 System.out.println("HOTEL RESERVATION COMPENSATION"); 87 try { 88 bean.unreserveRooms(rooms); 89 } catch (DBException e) { 90 System.out.println( 91 "HOTEL RESERVATION COMPENSATION NOT PERFORMED DUE TO A DB ERROR!!!"); 92 } 93 System.out.println("HOTEL RESERVATION COMPENSATION MADE SUCCESSFULLY!!!"); 94 } 95 96 99 public void forget() { 100 bean = null; 101 rooms = 0; 102 } 103 } 104 | Popular Tags |