code: public static <ParameterType>
      RpcCallback<ParameterType> newOneTimeCallback(
        final RpcCallback<ParameterType> originalCallback) {
      return new RpcCallback<ParameterType>() {
        private boolean alreadyCalled = false;
  
        public void run(final ParameterType parameter) {
          synchronized(this) {
            if (alreadyCalled) {
              throw new AlreadyCalledException();
            }
            alreadyCalled = true;
          }
  
          originalCallback.run(parameter);
        }
      };
    }
docs: Creates a callback which can only be called once.  This may be useful for
  security, when passing a callback to untrusted code:  most callbacks do
  not expect to be called more than once, so doing so may expose bugs if it
  is not prevented.