@Override
	protected void exec() {
		try {
			synchronized (start) {
				if(!start.isBound()) {
					start.wait();
				}
			}
		} catch (InterruptedException e) {
			//e.printStackTrace();
			if(Config.debug)
				System.out.println(this+ " is intrrupted");
		}
		
		Vertex end;
		if(start.equals(edge.getV1())) {
			end = edge.getV2();
		} else {
			end = edge.getV1();
		}
		List<Binding> intermediate = new ArrayList<Binding>(start.getBindings());
		Set<Binding> results = te.exec(intermediate);
		if(end.isBound()) {
			results = QueryUtil.join(results, end.getBindings());
		}
		
		results = QueryUtil.join(input, results);
		if(Config.debug) {
			System.out.println(edge+": "+results.size());
		}
		if(results.size()==0) {
			finished = true;
			//System.out.println("SE shutdown");
			BGPEval.getCurrentExeService().shutdownNow();
		}
		end.setBindings(results);
		synchronized (end) {
			end.notifyAll();
		}
		start.removeEdge(edge);
		end.removeEdge(edge);
	}