private <T> T deserializeResponseContent(String responseBody, Class<T> entityClass) {
   JaxbSerializationProvider jaxbSerializationProvider = config.getJaxbSerializationProvider();
   T responseEntity = null;
   try {
     responseEntity = (T) jaxbSerializationProvider.deserialize(responseBody);
   } catch (ClassCastException cce) {
     throw new RemoteApiException(
         "Unexpected entity in response body, expected " + entityClass.getName() + " instance.",
         cce);
   }
   return responseEntity;
 }
 public void dispose() {
   if (jaxbSerializationProvider != null) {
     jaxbSerializationProvider.dispose();
     jaxbSerializationProvider = null;
   }
   if (extraJaxbClasses != null) {
     extraJaxbClasses.clear();
     extraJaxbClasses = null;
   }
   if (connectionFactory != null) {
     connectionFactory = null;
   }
   if (ksessionQueue != null) {
     ksessionQueue = null;
   }
   if (taskQueue != null) {
     taskQueue = null;
   }
   if (responseQueue != null) {
     responseQueue = null;
   }
 }