We study the sojourn time in a queueing system with a single exponential server, serving a Poisson stream of customers in order of arrival. Service is provided at a low or high rate, which can be adapted at exponential inspection times. When the number of customers in the system is above a given threshold, the service rate is upgraded to the high rate, otherwise, it is downgraded to the low rate. The state dependent changes in the service rate make the analysis of the sojourn time a challenging problem, since the sojourn time now also depends on future arrivals. We determine the Laplace transform of the stationary sojourn time and describe a procedure to compute all moments as well. First we analyze the special case of continuous inspection...