aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/Main.java29
-rw-r--r--src/org/traccar/geocode/GoogleReverseGeocoder.java9
-rw-r--r--src/org/traccar/geocode/ReverseGeocoder.java8
-rw-r--r--src/org/traccar/helper/Log.java27
4 files changed, 31 insertions, 42 deletions
diff --git a/src/org/traccar/Main.java b/src/org/traccar/Main.java
index 144ad1ec7..b7ae3e924 100644
--- a/src/org/traccar/Main.java
+++ b/src/org/traccar/Main.java
@@ -15,38 +15,11 @@
*/
package org.traccar;
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryMXBean;
-import java.lang.management.OperatingSystemMXBean;
-import java.lang.management.RuntimeMXBean;
import java.util.Locale;
import org.traccar.helper.Log;
public class Main {
- private static void printSystemInfo() {
- try {
- OperatingSystemMXBean operatingSystemBean = ManagementFactory.getOperatingSystemMXBean();
- Log.info("Operating System" +
- " name: " + operatingSystemBean.getName() +
- " version: " + operatingSystemBean.getVersion() +
- " architecture: " + operatingSystemBean.getArch());
-
- RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean();
- Log.info("Java Runtime" +
- " name: " + runtimeBean.getVmName() +
- " vendor: " + runtimeBean.getVmVendor() +
- " version: " + runtimeBean.getVmVersion());
-
- MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
- Log.info("Memory Limit" +
- " heap: " + memoryBean.getHeapMemoryUsage().getMax() / (1024 * 1024) + "mb" +
- " non-heap: " + memoryBean.getNonHeapMemoryUsage().getMax() / (1024 * 1024) + "mb");
- } catch (Exception e) {
- Log.warning("Failed to get system info");
- }
- }
-
public static void main(String[] args) throws Exception {
Locale.setDefault(Locale.ENGLISH);
@@ -54,7 +27,7 @@ public class Main {
service.init(args);
Log.info("Starting server...");
- printSystemInfo();
+ Log.logSystemInfo();
service.start();
diff --git a/src/org/traccar/geocode/GoogleReverseGeocoder.java b/src/org/traccar/geocode/GoogleReverseGeocoder.java
index 1e61eb6ee..9aebbf8a0 100644
--- a/src/org/traccar/geocode/GoogleReverseGeocoder.java
+++ b/src/org/traccar/geocode/GoogleReverseGeocoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2012 - 2013 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,16 +23,11 @@ import java.nio.charset.Charset;
import org.traccar.helper.Log;
-/**
- * Reverse geocoder implementation using Google
- */
public class GoogleReverseGeocoder implements ReverseGeocoder {
private final static String MARKER = "\"formatted_address\" : \"";
- /**
- * Get address string by coordinates
- */
+ @Override
public String getAddress(double latitude, double longitude) {
try {
diff --git a/src/org/traccar/geocode/ReverseGeocoder.java b/src/org/traccar/geocode/ReverseGeocoder.java
index d8ea5d7ab..67ce68ac2 100644
--- a/src/org/traccar/geocode/ReverseGeocoder.java
+++ b/src/org/traccar/geocode/ReverseGeocoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2012 - 2013 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,14 +15,8 @@
*/
package org.traccar.geocode;
-/**
- * Reverse geocoder interface
- */
public interface ReverseGeocoder {
- /**
- * Get address string by coordinates
- */
public String getAddress(double latitude, double longitude);
}
diff --git a/src/org/traccar/helper/Log.java b/src/org/traccar/helper/Log.java
index d14a7b0bb..a5e9f7594 100644
--- a/src/org/traccar/helper/Log.java
+++ b/src/org/traccar/helper/Log.java
@@ -16,6 +16,10 @@
package org.traccar.helper;
import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.RuntimeMXBean;
import java.util.Properties;
import org.apache.log4j.Appender;
import org.apache.log4j.DailyRollingFileAppender;
@@ -63,6 +67,29 @@ public class Log {
return logger;
}
+ public static void logSystemInfo() {
+ try {
+ OperatingSystemMXBean operatingSystemBean = ManagementFactory.getOperatingSystemMXBean();
+ Log.info("Operating System" +
+ " name: " + operatingSystemBean.getName() +
+ " version: " + operatingSystemBean.getVersion() +
+ " architecture: " + operatingSystemBean.getArch());
+
+ RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean();
+ Log.info("Java Runtime" +
+ " name: " + runtimeBean.getVmName() +
+ " vendor: " + runtimeBean.getVmVendor() +
+ " version: " + runtimeBean.getVmVersion());
+
+ MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
+ Log.info("Memory Limit" +
+ " heap: " + memoryBean.getHeapMemoryUsage().getMax() / (1024 * 1024) + "mb" +
+ " non-heap: " + memoryBean.getNonHeapMemoryUsage().getMax() / (1024 * 1024) + "mb");
+ } catch (Exception e) {
+ Log.warning("Failed to get system info");
+ }
+ }
+
public static void error(String msg) {
getLogger().error(msg);
}