public MethodRequest dequeue()  {
		
		lock.lock();
		MethodRequest result = null;
		
		try {

			while(mixedQueue.size()==0) 
				isTask.await();
				
			MethodRequest preview = mixedQueue.peek();

			if(preview.name.equals("Producer"))
			{
				if(servant.howMany+preview.howMany<bufferSize){
					result = mixedQueue.poll();
					producerQueue.poll();
				}
				else
				{
					while( konsumerQueue.size()==0 ) 
						isKonsumer.await();
						
					result = konsumerQueue.poll();
					mixedQueue.remove(result);
					
				}
			}
			else
			{
				if(servant.howMany-preview.howMany>0){
					result = mixedQueue.poll();
					konsumerQueue.poll();
				}
				else
				{
					while( producerQueue.size()==0 ) 
						isProducer.await();
					
					result = producerQueue.poll();
					mixedQueue.remove(result);
				}
			}
		} catch (Exception e) {
			//e.printStackTrace();
		}
		finally{
			lock.unlock();
		}
		return result;
	}