private void checkPause() 
	{
		// double check
		if (paused) 
		{
			synchronized (state) 
			{
				// Actually pausing?
				if (state.has(Pausing)) 
				{
					// Pause!
					state.set(Paused);
					
					// Notify all listeners of pause.
					notifier.proxy().onServicePause(this, interrupt);
					
					// Wait for the running or stopping state.
					state.waitFor(Running | Stopping);
					
					// Notify all listeners of resume.
					notifier.proxy().onServiceResume(this, interrupt);
				}
			}
		}
	}