Skip to content

additional null-checking apis for locking? #510

@hrstoyanov

Description

@hrstoyanov

Is your feature request related to a problem? Please describe.

With lockers one can do this:

class Store extends StripeLockScope {

    private static final IndexerLong ID_INDEXEER = ...;
    private GigaMap map = ... ;
     
    void doSomething(UUID entityId){
         read(entityId, ()->{
                var e = map.query(ID_INDEXER.is(entityId)).findFirst();
                ...
          });
  }
}

if the entityId input is NULL the query would have still worked , but the read lock will cause NullPointerException, so one need to guard with a null check:

   if(entityId!=null){
        read(...);
   }
    

This quickly becomes noise/boring, if you have a lot of these apis .

Describe the solution you'd like

Add to StripeLockScope/ReadWriteLocked/etc. null-checking apis.

Describe alternatives you've considered

Take a look at the attached workaround I currently use - something like this could become part of EclipseStore core?

NullCheckingStripeLockScope.java

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions