public Counter getOrCreateCounter ( String name , long initial_value ) throws Exception { Object existing_value = allow_dirty_reads ? _get ( name ) : invoke ( Command . get , name , false ) ; if ( existing_value != null ) counters . put ( name , ( Long ) existing_value ) ; else { Object retval = invoke ( Command . create , name , false , initial_value ) ; if ( retval instanceof Long ) counters . put ( name , ( Long ) retval ) ; } return new CounterImpl ( name , this ) ; }
Returns an existing counter or creates a new one if none exists