@@ -44,16 +44,19 @@ public class TrackingPublisher {
4444 private static final long TERMINATION_TIMEOUT_MS = 10 ;
4545
4646 private final String deviceId ;
47+ private final String trackerName ;
4748 private final LinkedBlockingQueue <DevicePositionUpdate > positionUpdateQueue ;
4849 private final LinkedBlockingQueue <BatchUpdateDevicePositionRequest > batchRequestQueue ;
4950 private final ScheduledFuture <?> scheduledFuture ;
5051 private final ScheduledExecutorService scheduledExecutorService ;
5152 private final BatchPublisher batchPublisher ;
5253
5354 public TrackingPublisher (AmazonLocationClient locationClient ,
54- String deviceId ) {
55+ String deviceId ,
56+ String trackerName ) {
5557 this (locationClient ,
5658 deviceId ,
59+ trackerName ,
5760 DEFAULT_WORKER_POOL_SIZE ,
5861 DEFAULT_PUBLISH_INTERVAL_MS ,
5962 DEFAULT_BATCH_SIZE ,
@@ -62,12 +65,14 @@ public TrackingPublisher(AmazonLocationClient locationClient,
6265
6366 public TrackingPublisher (AmazonLocationClient locationClient ,
6467 String deviceId ,
68+ String trackerName ,
6569 int workerPoolSize ,
6670 long publishIntervalMillis ,
6771 int batchSize ,
6872 TrackingListener listener ) {
6973 this (locationClient ,
7074 deviceId ,
75+ trackerName ,
7176 Executors .newScheduledThreadPool (workerPoolSize ),
7277 publishIntervalMillis ,
7378 batchSize ,
@@ -76,11 +81,13 @@ public TrackingPublisher(AmazonLocationClient locationClient,
7681
7782 public TrackingPublisher (AmazonLocationClient locationClient ,
7883 String deviceId ,
84+ String trackerName ,
7985 ScheduledExecutorService scheduledExecutorService ,
8086 long publishIntervalMillis ,
8187 int batchSize ,
8288 TrackingListener listener ) {
8389 this .deviceId = deviceId ;
90+ this .trackerName = trackerName ;
8491 positionUpdateQueue = new LinkedBlockingQueue <>(batchSize );
8592 batchRequestQueue = new LinkedBlockingQueue <>();
8693 batchPublisher = new BatchPublisher (locationClient , batchRequestQueue , listener );
@@ -185,7 +192,7 @@ private void flush(boolean force) {
185192 */
186193 private BatchUpdateDevicePositionRequest createNewBatch () {
187194 BatchUpdateDevicePositionRequest batch = new BatchUpdateDevicePositionRequest ();
188- batch .setTrackerName (deviceId );
195+ batch .setTrackerName (trackerName );
189196 batch .setUpdates (new ArrayList <DevicePositionUpdate >());
190197 return batch ;
191198 }
0 commit comments