public PrefetchManager(TraceFile traceFile, Statistics statistics, HazelcastClient hazelcastClient, string scenarioId, ArrayList outputLinks, ITimeSpan timeHorizon, bool isEnabled, WebServiceManager webServiceManager)
        {
            this.traceFile = traceFile;
            this.statistics = statistics;
            this.hazelcastClient = hazelcastClient;
            this.scenarioId = scenarioId;
            this.isEnabled = isEnabled;
            this.webServiceManager = webServiceManager;

            mapValueSet = hazelcastClient.getMap<string, ValueSetEntry>("valueSet");
            queueValueSetRequest = hazelcastClient.getQueue<ValueSetRequestEntry>("valueSetRequest");

            prefetchMonitor = new PrefetchMonitor(outputLinks, traceFile, timeHorizon);
        }
        private void ConnectToInstance(string instanceAddr, string instancePort, List<WebServiceEntry> webServiceInfoList)
        {
            var clientConfig = new ClientConfig();
            clientConfig.addAddress(instanceAddr + ":" + instancePort);
            clientConfig.GroupConfig = new GroupConfig("dev", "dev-pass");
            clientConfig.TypeConverter = new MyTypeConverter();

            // connect to the hazelcast instance
            while (client == null)
            {
                try
                {
                    client = HazelcastClient.newHazelcastClient(clientConfig);
                }
                catch (Exception)
                {
                    traceFile.Append("Failed to connect to " + instanceAddr + ":" + instancePort);
                    Thread.Sleep(5000);
                }
            }

            // tell the instances that we're active
            var mapClient = client.getMap<string, string>("client");
            mapClient.put(GetUniqueId(), "active");

            var mapWebServiceInfo = client.getMap<String, WebServiceEntry>("webService");
            foreach (var nextWebServiceInfo in webServiceInfoList)
            {
                mapWebServiceInfo.put(nextWebServiceInfo.Id, nextWebServiceInfo);
            }
        }