1 | Given
Bean1 --> Stateful session Bean's local interface of 'bean1'
Bean2 --> Stateless Session Bean's local interface of 'bean2'
and given:
@EJB(beanName="bean1") Bean1 ref1;
@EJB(beanName="bean1") Bean1 ref2;
@EJB(beanName="bean2") Bean2 ref3;
@EJB(beanName="bean2") Bean2 ref4;
After injection has completed, what would be the output of the following code?
System.out.println(ref1.equals(ref2));
System.out.println(ref3.equals(ref4)); |
2 | EJB supports scheduling system called Timer Service.
Which interface must implemented by an enterprise bean to be able to be scheduled ? |
3 | Which of the following stateless bean definitions are correct to be able to be scheduled? |
4 | Which of the following statements about Timer are correct? |
5 | Given a Car EJB used to schedule perticular car for Maintenance, which is being sceduled as below :
@Stateless
public class Foo implements FooRemote{
@Resource TimerService timerService;
@Timeout
public void maintenanceCall(){
// maintenance appropriate Logic
}
public void ScheduleMaintenance(Integer carId, Date dayToBeScheduled){
timerService.createTimer( dayToBeScheduled, carId.toString());
}
public void resceduleMaintenance(Integer carId, Date rescheduleDate){
//Block 1
}
}
What are the appropriate code to be inserted in //Block 1 to reschedule a car maintenance to a new time? |
6 | Given a Timer scheduled as below:
Calendar time = Calendar.getInstance();
time.add(Calendar.DATE,15);
Date initialExpiration =
Timer timer = timerService.createTimer(time.getTime(),1000*60*60*24,"Timer1");
what will be the result of calling timer.getNextTimeout()? |
7 | Check if the following statement about the Timer is true or false.
If a bean calls timerService.createTimer() method in the scope of a transaction, and if the transaction rolls back, this will not affect the timer. As timers are persistent, it will stay scheduled. |
8 | Given 2 Session beans, Foo and Foo1
@Stateless
public class Foo implements FooRemote{
private Foo1 foo1;
@Resource TimerService timerService;
@PostConstruct
public void init(){ // block 1 }
@PreDestory
public void finish(){ // block 2 }
// business method
public void doBusinessAction(){ // block 3 }
@EJB
public setFoo1(Foo1 foo1){
//Block 4
this.foo1 = foo1;
}
}
Which are the legal blocks to place following code:
timerService.createTimer(expDate,"test Timer"); |
9 | Which of the following statements about @PostConstruct callback method of an EJB are true? |
10 | Which of the following statements about session beans are true? |