public ViewPermissionContext attachClientToSharedViewProcess(final UniqueId clientId,
final ViewResultListener listener, final UniqueId viewDefinitionId, final ViewExecutionOptions executionOptions) {
ArgumentChecker.notNull(clientId, "clientId");
ArgumentChecker.notNull(viewDefinitionId, "viewDefinitionId");
ArgumentChecker.notNull(executionOptions, "executionOptions");
final ViewClientImpl client = getViewClient(clientId);
_processLock.lock();
ViewProcessImpl process = null;
try {
process = getOrCreateSharedViewProcess(viewDefinitionId, executionOptions, client.getResultMode(), client.getFragmentResultMode());
return attachClientToViewProcessCore(client, listener, process);
} catch (final Exception e) {
// Roll-back
if (process != null) {
removeViewProcessIfUnused(process);