function [OK, serVal, serWarnings] = remoteRetrieval(key, arrayHolderToClear)
% Retrieve value from value store
% Value, warnings, key and error are serialized

% Copyright 2008-2020 The MathWorks, Inc.

keysToClear = int64.empty();
if ~isempty(arrayHolderToClear)
    keysToClear = arrayHolderToClear.array();
end

wc = parallel.internal.general.WarningsCollector();
try
    [OK, val] = spmdlang.remoteRetrievalPlain(distcompdeserialize(key), keysToClear);
    serVal = parallel.internal.pool.serialize(val);
catch E
    serVal = parallel.internal.pool.serialize(E);
    OK = false;
end
serWarnings = parallel.internal.pool.serialize(wc.Warnings);

end
