Set the Transaction Name After a Start

The following example shows how to set the transaction name after it has been started. This is useful if you want to split transactions based on events that happen in your application:

Note: Transaction name can only be set after a start on the originating segment, and if no async hand-offs or exits have been made.
public String checkout(List<ItemOrders> orders) {
AppdynamicsAgent.startTransaction("Checkout", null, EntryTypes.POJO, false);
/*******************
* Method Body Here
*******************/
if (orders.isEmpty()) {
AppdynamicsAgent.setCurrentTransactionName("Empty Cart");
}
AppdynamicsAgent.getTransaction().end();
}