/// <summary> /// Close an existing client /// </summary> /// <param name="client">client to dispose</param> private static void DisposeClient(ref VertexCallbackServiceClient client) { if (client != null) { try { client.Close(); } catch (Exception) { try { client.Abort(); } catch (Exception) { // If client cannot be aborted, just finish silently. } } client = null; } else { throw new ArgumentNullException("client"); } }
/// <summary> /// Creates a new WCF client to service listening at URI /// </summary> /// <param name="uri">wcf service endpoint</param> /// <returns>client to WCF service</returns> private static VertexCallbackServiceClient CreateClient(string uri) { VertexCallbackServiceClient client = new VertexCallbackServiceClient(binding, new EndpointAddress(uri)); lock (syncRoot) { // // If the graph manager URI is specified, store this client as the GM client, otherwise assume it's a vertex host // if (IsGraphMrgUri(uri)) { graphMgrUri = uri; graphMgrClient = client; } else { vertexProcUri = uri; vertexProcClient = client; } } return client; }