Acquirable API
Presentation
Acquirable<Entity> acquirableEntity = ...;
System.out.println("Start acquisition...");
acquirableEntity.sync(entity -> {
// You can use "entity" safely in this consumer!
});
System.out.println("Acquisition happened successfully"); private Acquirable<Entity> myEntity; // <- GOOD
// private Entity myEntity <- NO GOOD, DONT DO THAT
public void randomMethod(Acquirable<Entity> acquirableEntity) {
this.myEntity = acquirableEntity;
acquirableEntity.sync(entity -> {
// "myEntity = entity" is not safe, always cache the acquirable object
});
}Acquirable Collections
Naive loop
AcquirableCollection#forEachSync
Access the acquirable object without acquiring it
Access all the entities in the current thread
What type to request and return in methods
Last updated
Was this helpful?
