sync.before_completion();
}
if (resources.size() == 1){
Resource r = (Resource)resources.elementAt(0);
try {
r.commit_one_phase();
} catch(org.omg.CORBA.TRANSACTION_ROLLEDBACK tr) {
// the only one resource requested a rollback
votes.setElementAt(Vote.VoteRollback,0);
rollback();
throw new org.omg.CORBA.TRANSACTION_ROLLEDBACK();
} catch(HeuristicHazard hh) {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
votes.setElementAt(Vote.VoteCommit,0);
if (!move_to_state(Status._StatusPrepared)){
throw new org.omg.CORBA.INTERNAL();
}
if (!move_to_state(Status._StatusCommitting)){
throw new org.omg.CORBA.INTERNAL();
}
} else {
for (int i = 0;i < resources.size();i++){
Resource r = (Resource)resources.elementAt(i);
try {
Vote v = r.prepare();
votes.setElementAt(v, i);
if (v.value() == Vote._VoteRollback){
rollback();
throw new org.omg.CORBA.TRANSACTION_ROLLEDBACK();
}
} catch(HeuristicHazard hh) {
throw new org.omg.CORBA.NO_IMPLEMENT();
} catch(HeuristicMixed hm) {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
}
if (!move_to_state(Status._StatusPrepared)){
throw new org.omg.CORBA.INTERNAL();
}
if (!move_to_state(Status._StatusCommitting)){
throw new org.omg.CORBA.INTERNAL();
}
for (int i = 0;i < resources.size();i++){
Resource r = (Resource)resources.elementAt(i);
Vote v = (Vote)votes.elementAt(i);
try {
if (v == null){
throw new org.omg.CORBA.INTERNAL();
} else {
if (v.value() == Vote._VoteCommit){
r.commit();
}
}
} catch(NotPrepared np) {
throw new org.omg.CORBA.NO_IMPLEMENT();
} catch(HeuristicRollback hr) {