class FunctionExecutionServiceImpl implements FunctionExecutionService {

	@Override
	public TokenWrapper getTokenHandle(Map<String, String> attributes, Map<String, Interest> interests, boolean createSession, TokenWrapperOwner tokenWrapperOwner) throws FunctionExecutionServiceException {
		try {
			return gridClient.getTokenHandle(attributes, interests, createSession, tokenWrapperOwner);
		} catch (AgentCallTimeoutException e) {
			throw new FunctionExecutionServiceException("Timeout after "+e.getCallTimeout()+"ms while reserving the agent token. You can increase the call timeout by setting 'grid.client.token.reserve.timeout.ms' in step.properties",e );
		} catch (AgentSideException e) {
			throw new FunctionExecutionServiceException("Unexepected error on the agent side while reserving the agent token: "+e.getMessage(),e);
		} catch (AgentCommunicationException e) {
			throw new FunctionExecutionServiceException("Communication error between the controller and the agent while reserving the agent token",e);
		} 
	}

	public  FunctionExecutionServiceImpl(GridClient gridClient, FunctionTypeRegistry functionTypeRegistry, DynamicBeanResolver dynamicBeanResolver);

}