anchor.diff:  
   -behaviour(gen_server).
   
  --define(QUEUE, queue).
   -define(DEFAULT_MAX_ENTRIES, 1000).
   
   -export([
  
positive.code:     {stop, normal, State};
  
  handle_cast({in, Msg}, #state{max_entries=MaxEntries,queue=OldQueue}=State) ->
      Queue = case MaxEntries =< ?QUEUE:len(OldQueue) of
          true -> ?QUEUE:liat(OldQueue);
          false -> OldQueue
      end,
      {noreply, State#state{queue = ?QUEUE:in(Msg, Queue)}};
  
  handle_cast(_Msg, State) ->
      {noreply, State}.
  
negative.code: %% @hidden
  -spec handle_call(X::term(), reference(), state()) -> {reply, {Failed::apns:msg(), RestToRetry::[apns:msg()]}, state()}.
  handle_call({fail, ID}, _From, #state{queue=Queue}=State) ->
      {reply, recover_fail(ID, Queue), State#state{queue=queue:new()}};
  
  handle_call(_Msg, _From, State) ->
      {reply, ok, State}.
  