private void ExecuteSubQuery() throws OptimizerException
	{
		Repository repo =new SPARQLRepository(serviceSubQuery.getEndpointAdress().toString()) ;
		try 
		{
			repo.initialize() ;
			RepositoryConnection con;
			con = repo.getConnection();
			TupleQuery remoteQuery;
			remoteQuery = con.prepareTupleQuery(QueryLanguage.SPARQL,serviceSubQuery.getQueryString());
			TupleQueryResult queryResultSet =remoteQuery.evaluate() ;
			int randomPriority=0 ;
			int rnd =0 ;
			while (queryResultSet.hasNext())
			{
				tupleCounter++ ;
				this.lastTupleArriveTime=System.currentTimeMillis() ;
				BindingSet BindSet =queryResultSet.next() ;
				QueryBindingSet queryBindSet =new QueryBindingSet(BindSet);
				Tuple receivedTuple =new Tuple() ;
				receivedTuple.getSubQueryList().add(serviceSubQuery.getSubQueryName()) ;
				receivedTuple.setReadyBits(serviceSubQuery.getReadyBitPattern()) ;
				receivedTuple.setDoneBits(0);
				receivedTuple.setBindingSet(queryBindSet) ;
				if (useRandomPriority)
				{
					rnd=rndGenerator.nextInt(this.randomCeiling) ;
					randomPriority = rnd - this.tupleCounter ;
					receivedTuple.setPriority(randomPriority);
				}
				else
				{
					receivedTuple.setPriority(0);
				}
				//receivedTuple.setPriority(1);
				TupleHeap.put(receivedTuple);
				//System.out.println(this.subQueryName+" "+tupleCounter);
			}
			//Following jeens recommendation i close the TupleQueryResult
			queryResultSet.close() ;
			//Say eddy that this thread has finished it's work .
			isFinished=true;
			PoisonPill poisonSubQueryFinished=new PoisonPill(ThreadStatus.Termintaed, PoisonPill.subQueryExecuterPillType, Thread.currentThread().getName());
			poisonSubQueryFinished.setPriority(0);
			TupleHeap.add(poisonSubQueryFinished) ;
			//========================TEST=================
			myLogger.printInfo("Sub Query "+this.subQueryName+"Finished with"+tupleCounter+" Tuples.");
			//System.out.println("Sub Query "+this.subQueryName+"Finished with"+tupleCounter+" Tuples.");
			Eddy.getInstance().incFinishedSqExecuters(false) ;
		}
		catch (RepositoryException e) 
		{
			OptimizerException optm =new OptimizerException("Subquery ID="+subQueryName+"\nEndpoint Address="+serviceSubQuery.getEndpointAdress()+"\nSubQuery="+serviceSubQuery.getQueryString()+e);
			throw optm;
		}
		catch (MalformedQueryException e) 
		{
			OptimizerException optm =new OptimizerException("Subquery ID="+subQueryName+"\nEndpoint Address="+serviceSubQuery.getEndpointAdress()+"\nSubQuery="+serviceSubQuery.getQueryString()+e);
			throw optm;
		}
		catch (QueryEvaluationException e) 
		{
			OptimizerException optm =new OptimizerException("Subquery ID="+subQueryName+"\nEndpoint Address="+serviceSubQuery.getEndpointAdress()+"\nSubQuery="+serviceSubQuery.getQueryString()+e);
			throw optm;
		} 
		catch (InterruptedException e) 
		{
			OptimizerException optm =new OptimizerException("Subquery ID="+subQueryName+"\nEndpoint Address="+serviceSubQuery.getEndpointAdress()+"\nSubQuery="+serviceSubQuery.getQueryString()+e);
			throw optm;
		}
	}