All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vmlens.trace.agent.bootstrap.parallize.logic.RunLogic Maven / Gradle / Ivy

There is a newer version: 1.1.5
Show newest version
package com.vmlens.trace.agent.bootstrap.parallize.logic;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Map;
import java.util.Map.Entry;

import com.vmlens.trace.agent.bootstrap.callback.AgentLogCallback;
import com.vmlens.trace.agent.bootstrap.interleave.InterleaveFacade;
import com.vmlens.trace.agent.bootstrap.interleave.lock.LockOperation;
import com.vmlens.trace.agent.bootstrap.parallize.ParallizeSingelton;
import com.vmlens.trace.agent.bootstrap.parallize.logicState.DecisionQueue;
import com.vmlens.trace.agent.bootstrap.parallize.logicState.DecisionStack;
import com.vmlens.trace.agent.bootstrap.parallize.logicState.InterleaveControlLogic;

public class RunLogic extends RunLogicAbstract {

	public RunLogic(RunStateActive runStateActive, InterleaveFacade interleaveFacade) {
		super(runStateActive,interleaveFacade);
		
	}

	@Override
	protected void waitTillActive(long threadId) throws InterruptedException
	 {
		 
		 long startedWaiting = System.currentTimeMillis();
		 
		 while(interleaveControlLogic.needs2Wait(threadId , System.currentTimeMillis()))
			{
				ParallizeSingelton.SINGLE_LOCK.wait(10);
				
				if(  System.currentTimeMillis() > startedWaiting + InterleaveControlLogic.TIMEOUT +   2000 )
				{
					
					
					
					AgentLogCallback.logTimeout(interleaveControlLogic.threadId2State ,interleaveControlLogic.logicState );
					
					return;
				}
				
				
			}
		 
	 }

	@Override
	protected void notifyMonitor() {
		 ParallizeSingelton.SINGLE_LOCK.notifyAll();
		
	}

	
	
	

	

	
	
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy