public class DefaultLogUploadStrategy extends Object implements LogUploadStrategy
LogUploadStrategy
.Modifier and Type | Field and Description |
---|---|
protected int |
batchCount |
protected int |
batchSize |
protected int |
countThreshold |
protected boolean |
isUploadLocked |
protected int |
maxParallelUploads |
protected int |
retryPeriod |
protected int |
timeout |
protected int |
uploadCheckPeriod |
protected int |
volumeThreshold |
Constructor and Description |
---|
DefaultLogUploadStrategy() |
Modifier and Type | Method and Description |
---|---|
protected LogUploadStrategyDecision |
checkUploadNeeded(LogStorageStatus status) |
int |
getBatchCount()
Retrieves maximum count of the records in report pack
that will be delivered in single request to server
|
long |
getBatchSize()
Retrieves maximum size of the report pack
that will be delivered in single request to server
|
int |
getCountThreshold() |
int |
getMaxParallelUploads()
Returns max parallel upload count
|
int |
getTimeout()
Maximum time to wait log delivery response.
|
int |
getUploadCheckPeriod()
If there are records in storage we need to periodically check isUploadNeeded method.
|
int |
getVolumeThreshold() |
boolean |
isUploadLocked() |
LogUploadStrategyDecision |
isUploadNeeded(LogStorageStatus status)
Retrieves log upload decision based on current storage status and defined
upload configuration.
|
void |
lockUpload() |
void |
onFailure(LogFailoverCommand controller,
org.kaaproject.kaa.common.endpoint.gen.LogDeliveryErrorCode code)
Handles failure of log delivery
|
void |
onTimeout(LogFailoverCommand controller)
Handles timeout of log delivery
|
void |
setBatch(int batch) |
void |
setBatchCount(int batchCount) |
void |
setCountThreshold(int countThreshold) |
void |
setMaxParallelUploads(int maxParallelUploads) |
void |
setRetryPeriod(int retryPeriod) |
void |
setTimeout(int timeout) |
void |
setUploadCheckPeriod(int uploadCheckPeriod) |
void |
setVolumeThreshold(int volumeThreshold) |
void |
unlockUpload() |
protected int timeout
protected int uploadCheckPeriod
protected int retryPeriod
protected int volumeThreshold
protected int countThreshold
protected int batchSize
protected int batchCount
protected int maxParallelUploads
protected volatile boolean isUploadLocked
public LogUploadStrategyDecision isUploadNeeded(LogStorageStatus status)
LogUploadStrategy
isUploadNeeded
in interface LogUploadStrategy
status
- Log storage statusLogUploadStrategyDecision
)protected LogUploadStrategyDecision checkUploadNeeded(LogStorageStatus status)
public long getBatchSize()
LogUploadStrategy
getBatchSize
in interface LogUploadStrategy
public int getBatchCount()
LogUploadStrategy
getBatchCount
in interface LogUploadStrategy
public int getTimeout()
LogUploadStrategy
getTimeout
in interface LogUploadStrategy
public void onTimeout(LogFailoverCommand controller)
LogUploadStrategy
onTimeout
in interface LogUploadStrategy
public void onFailure(LogFailoverCommand controller, org.kaaproject.kaa.common.endpoint.gen.LogDeliveryErrorCode code)
LogUploadStrategy
onFailure
in interface LogUploadStrategy
public void setTimeout(int timeout)
public void setRetryPeriod(int retryPeriod)
public int getVolumeThreshold()
public void setVolumeThreshold(int volumeThreshold)
public int getCountThreshold()
public void setCountThreshold(int countThreshold)
public void setBatch(int batch)
public void setBatchCount(int batchCount)
public int getUploadCheckPeriod()
LogUploadStrategy
getUploadCheckPeriod
in interface LogUploadStrategy
public void setUploadCheckPeriod(int uploadCheckPeriod)
public void lockUpload()
public void unlockUpload()
public boolean isUploadLocked()
public int getMaxParallelUploads()
LogUploadStrategy
getMaxParallelUploads
in interface LogUploadStrategy
public void setMaxParallelUploads(int maxParallelUploads)
Copyright © 2015. All rights reserved.