@Documented
@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface StoreReturn
This annotation will wrap the decorated method to ensure thread isolation.
You can store a Method return statement.
A method such as this:
@StoreReturn
protected Customer updateCustomer(String id, CustomerSave customerSave) {
Customer c = data().getCustomers().get(id);
if (c != null) {
c.setFirstName(customerSave.getFirstName());
c.setLastName(customerSave.getLastName());
return c;
}
return null;
}
Becomes
protected Customer updateCustomer(String id, CustomerSave customerSave) {
XThreads.executeSynchronized(() -> {
Customer c = data().getCustomers().get(id);
if (c != null) {
c.setFirstName(customerSave.getFirstName());
c.setLastName(customerSave.getLastName());
embeddedStorageManager.store(c);
return c;
}
return null;
}
}
| Modifier and Type | Optional Element and Description |
|---|---|
java.lang.String |
name
The optional name qualifier of the Storage Manager to use.
|
StoringStrategy |
strategy
The Storing strategy.
|
@AliasFor(member="value") public abstract java.lang.String name
public abstract StoringStrategy strategy