Simultaneous calls policy

Understanding the frontier simultaneous calls policy

Simultaneous calls policy is the way Hi-framework gives you to configure its behavior regarding simultaneous calls of a specific frontier method. It allows you to:

  • Allow simultaneous calls
  • Allow simultaneous calls only with different arguments
  • Disable simultaneous calls completely (default behavior)

The simultaneous calls policy is configured using annotations on frontier methods.

Allowing simultaneous calls

Hi-Framework provides you mechanisms to allow simultaneous calls on frontier methods in two ways:

All simultaneous calls

The following code snippet shows how to enable simultaneous calls on a frontier method.

@Frontier
public class FrontierClazz {

    
    @MultipleCalls
    public void example(int arg1, int arg2){
    
        //We don't care about what comes in here
    
    }
    
}

Only calls with different arguments

Hi-Framework gives you the possibility to allow simultaneous calls of a frontier method only if the the arguments passed to each of the simultaneous calls are different.

Lets see an example:


    @Frontier
    public class FrontierClazz {
    
        
        @SingleCall(detectionMethod=CALL_PARAMS)
        public void example(int arg1, int arg2){
        
            //We don't care about what comes in here
        
        }
        
    }
    

The snippet above tells Hi-Framework to deny simultaneous calls of that frontier method using the same arguments.

@SingleCall(detectionMethod=CALL_PARAMS)
Only simultaneous calls with different arguments will be allowed


There is still one unanswered question here: how will Hi react when it detects an attempt of simultaneous frontier calls using the same arguments? The answer is: it will apply an abortion policy.

Abortion policy

Is the policy applied by Hi-Framework when it detects unauthorized simultaneous frontier method calls. Hi-Framework currently supports two abortion policies:

Will abort the already ongoing frontier call and let the new call proceed. This is the abortion policy applied by default. Will abort the frontier call that is attempting to initiate and leave the ongoing call.

Setting the abortion policy

The snippet below shows how to set an abortion policy.


  ...

  @SingleCall(detectionMethod=CALL_PARAMS,abortionPolicy=ABORT_NEW_INVOCATION)
  public void example(int arg1, int arg2){
            
     //We don't care about what comes in here
            
  }
    

WARNING
The @MultipleCalls annotation does not allow you to set an abortion policy because all simultaneous frontier calls will be allowed.

Disable simultaneous calls completely

WARNING
Hi-Framework disables simultaneous frontier calls by default and applies the ABORT_ONGOING_INVOCATION abortion policy.

As Hi-Framework already disables simultaneous calls by default, the only reason you would want to do it yourself, would be to change the abortion policy as follows:


    ...
    
    @SingleCall(detectionMethod=METHOD_CALL,abortionPolicy=ABORT_NEW_INVOCATION)
    public void example(int arg1, int arg2){
              
       //We don't care about what comes in here
              
    }   

This is it!

Github Repository