Hi,
It all depends on what you mean by "doing well", if you simply wish to make sure the first order was filled before submitting the second order you can use the code similar to the one below:
...
IOrder order = null;
order = engine.submitOrder("First", Instrument.EURUSD, OrderCommand.BUY, 0.001, 0); //market order
while (order.getState() == IOrder.State.CREATED || order.getState() == IOrder.State.OPENED) {
order.waitForUpdate(1, TimeUnit.SECONDS);
}
if (order != null && order.getState() == State.FILLED){
//submit the second order
}