/** * Returns an executor implementation where all tasks submitted on this executor will run on the * provided key. Tasks executed on the returned scheduler will be limited by the key * submitted on this instance equally with ones provided through the returned instance. * * @param permits resource permits for all tasks submitted on the returned executor * @param taskKey object key where {@code equals()} will be used to determine execution thread * @return Executor which will only execute with reference to the provided key */ public SubmitterExecutor getSubmitterExecutorForKey(double permits, Object taskKey) { ArgumentVerifier.assertNotNegative(permits, "permits"); ArgumentVerifier.assertNotNull(taskKey, "taskKey"); return new KeyedSubmitterExecutor(permits, taskKey); }
/** * Returns an executor implementation where all tasks submitted on this executor will run on the * provided key. Tasks executed on the returned scheduler will be limited by the key * submitted on this instance equally with ones provided through the returned instance. * * @param permits resource permits for all tasks submitted on the returned executor * @param taskKey object key where {@code equals()} will be used to determine execution thread * @return Executor which will only execute with reference to the provided key */ public SubmitterExecutor getSubmitterExecutorForKey(double permits, Object taskKey) { ArgumentVerifier.assertNotNegative(permits, "permits"); ArgumentVerifier.assertNotNull(taskKey, "taskKey"); return new KeyedSubmitterExecutor(permits, taskKey); }