public void run() {

		String input = null;
		String intermediateResult = null;

		try {

			BufferedReader reader = new BufferedReader(in);

			while ((input = reader.readLine()) != null) {

				intermediateResult = process(input);
				if (intermediateResult != null) {
					if (intermediateResult.length() > 0) {
						out.write(intermediateResult + "\n");
						out.flush();
					}
				}
			}
		
			isDone=true;		
		

		} catch (IOException e) {
			logger.error(e.getMessage());
			e.printStackTrace();
		} finally {
			success();
			while (!waitingFor.isDone()) {
				// waiting
				try {
					sleep(100);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}

			backup();

			try {
				if (out != null) {
					out.close();
				}
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}
	}