private void submitAndWaitForAllFromNonWorkerThread(final TaskGroup taskGroup)
		{
		//** reporting missing

		while (taskGroup.hasNext())
			{
			// block until a permit is available
			ComparableFutureTask ftask = taskGroup.next();

			if (ftask != null) // workaround possible concurrency issue
				{
				boolean done = false;
				int rejectionCount = 0;
				while (!done)
					{
					try
						{
						underlyingExecutor.execute(ftask);
						done = true;
						}
					catch (RejectedExecutionException e)
						{
						if (underlyingExecutor.isShutdown())
							{
							// there must have been an emergencyAbort, likely due to OutOfMemoryError.

							// we'll just return silently and trust that the OutOfMemoryError will be re-thrown from taskGroup.getAllExceptions();
							return;

							//	throw new RuntimeExecutionException("Executor has been shut down!?");
							}
						else
							{
							throw new RuntimeExecutionException(
									"Impossible: Executor rejects jobs even though it has not been shut down!?");
							}
						/*		if (rejectionCount >= 10)
						   {
						   throw new RuntimeExecutionException(e, "Task vas rejected 10 times in a row!");
						   }
					   rejectionCount++;
					   try
						   {
						   Thread.sleep(10);
						   }
					   catch (InterruptedException e1)
						   {
						   logger.error("Error", e1);
						   }*/
						}
					}
				}
			}

		// now all the tasks have been enqueued, but we need to wait for them to finish

		try
			{
			// block until all tasks are done
			taskGroup.blockUntilDone();
			taskGroup.getAllExceptions();
			}
		catch (ExecutionException e)
			{
			logger.error("Error", e);
			throw new Error(e);
			}
		catch (InterruptedException e)
			{
			logger.error("Error", e);
			throw new Error(e);
			}
		}