This is the method that is getting the error
public int getMaxTimeBetweenCustomers()
and this is the run method where the above^ method is being called. If I try to initialize the variable outside the method it does not work, so I'm not sure what to do.
private void doSomething() throws InterruptedException
maxCustomers = myController.getMaxCustomers();
while(myCounter < maxCustomers)
Customer customer= this.generateCustomer();
myServiceQueue = myServiceQueueManager.determineShortestQueue();
myTime = System.currentTimeMillis();
System.out.println("my counter " + myCounter);
message = e.getMessage();
The above method doSomething() is called in the run method
You state that the
getMaxTimeBetweenCustomers() method is causing your program to throw a StackOverflowException, but this is impossible if this method only contains the line of code you've shown. Something else is going on.
Likely that something else is that you've recursion going on. I have to guess, but perhaps
doSomething() is being called directly or indirectly from within one of the methods it contains, one of the methods listed below: