code: public static void setAllocator(IoBufferAllocator newAllocator) {
      if (newAllocator == null) {
        throw new NullPointerException("allocator");
      }
  
      IoBufferAllocator oldAllocator = allocator;
  
      allocator = newAllocator;
  
      if (null != oldAllocator) {
        oldAllocator.dispose();
      }
    }
docs: Sets the allocator used by existing and new buffers