package com.dbs.mplus.fatima.httpTask;

import java.util.HashMap;
import java.util.concurrent.ExecutionException;

public class HttpConRunnable implements Runnable {

  private String url = "";
  private HashMap<String, String> mData;
  private String action = "";
  private HttpCallBack callBack;

  public HttpConRunnable(String url, HashMap<String, String> mData, String action, HttpCallBack callBack) {
    this.url = url;
    this.mData = mData;
    this.action = action;
    this.callBack = callBack;
  }

  @Override
  public void run() {
    HttpCon httpCon = new HttpCon(url, mData, action);
    try {
      String result  = httpCon.execute().get();

      callBack.result(result);
    } catch (ExecutionException e) {
      e.printStackTrace();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }
}
