Replacing printStackTrace with logger
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
@ManagedService
public class ServicedSession implements ActiveSession {
+ private static Logger log = Logger.getLogger(ActiveSession.class.getName());
+
private final DriverService service;
private final SessionId id;
private final Dialect downstream;
@@ -105,7 +109,6 @@ public ServicedSession(
new JMXHelper().register(this);
}
-
@Override
public void execute(HttpRequest req, HttpResponse resp) throws IOException {
codec.handle(req, resp);
@@ -258,7 +261,7 @@ public Factory(String serviceClassName) {
new SessionId(response.getSessionId()),
(Map<String, Object>) response.getValue()));
} catch (IOException | IllegalStateException | NullPointerException e) {
- e.printStackTrace();
+ log.log(Level.WARNING, e.getMessage(), e);
throw new SessionNotCreatedException("Cannot establish new session: " + e.getMessage(), e);
}
}
