summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNils Schwabe2014-07-29 15:38:11 +0200
committerNils Schwabe2014-07-29 15:38:11 +0200
commitce4521c72addd556a87b26d87df18f815ed0bd11 (patch)
tree505adf188b9a5ef55004277fcace50947962b858
parentAdd some todos for updating an image (diff)
downloadmasterserver-ce4521c72addd556a87b26d87df18f815ed0bd11.tar.gz
masterserver-ce4521c72addd556a87b26d87df18f815ed0bd11.tar.xz
masterserver-ce4521c72addd556a87b26d87df18f815ed0bd11.zip
Move scheduling interval to config and some more todos
-rw-r--r--config/global.properties.example10
-rw-r--r--src/main/java/org/openslx/imagemaster/Globals.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java13
3 files changed, 21 insertions, 7 deletions
diff --git a/config/global.properties.example b/config/global.properties.example
index d4f46a2..238db02 100644
--- a/config/global.properties.example
+++ b/config/global.properties.example
@@ -65,4 +65,12 @@ ssl_keystore_password=password
# how often should the masterserver request a block
# from the satellite if the check sum fails
# until an error is sent
-ssl_socket_transmit_times=20 \ No newline at end of file
+ssl_socket_transmit_times=20
+
+#####################
+# CRC Scheduling #
+#####################
+
+# how often will the crc scheduler check the crc sums of uploading images in seconds
+# minimum of 60 s recommended
+crc_scheduling_interval=60 \ No newline at end of file
diff --git a/src/main/java/org/openslx/imagemaster/Globals.java b/src/main/java/org/openslx/imagemaster/Globals.java
index 8d836af..7289760 100644
--- a/src/main/java/org/openslx/imagemaster/Globals.java
+++ b/src/main/java/org/openslx/imagemaster/Globals.java
@@ -122,6 +122,11 @@ public class Globals
{
return Util.tryToParseInt( properties.getProperty( "ssl_socket_transmit_times" ) );
}
+
+ public static int getCrcSchedulingInterval()
+ {
+ return Util.tryToParseInt( properties.getProperty("crc_scheduling_interval") );
+ }
/* STRINGS */
diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java b/src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java
index 73e2f4a..ce89acd 100644
--- a/src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java
+++ b/src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java
@@ -306,16 +306,17 @@ public class ImageProcessor
{
List<DbImage> list = DbImage.getUploadingImages();
for ( DbImage image : list ) {
- String token = image.token;
- UploadingImage infos = new UploadingImage( token, image.blockStatus, image.timestamp.getTime(),
- image.uuid, image.imagePath );
- ConnectionHandler.addConnection( token, image.imagePath, Connection.UPLOADING ).image = infos;
- CRCFile crcFile = new CRCFile( Globals.getImageDir() + "/" + image.uuid + ".crc" );
+ UploadingImage infos = new UploadingImage( image.token, image.blockStatus, image.timestamp.getTime(), image.uuid, image.imagePath );
+ ConnectionHandler.addConnection( image.token, image.imagePath, Connection.UPLOADING ).image = infos;
+ CRCFile crcFile = new CRCFile( Globals.getImageDir() + "/" + image.uuid + ".crc" ); // TODO: has to be adjusted with the corresponding value above
try {
- if ( !crcFile.isValid() )
+ if ( !crcFile.isValid() ) {
continue;
+ // UploadingImage object contains an CRCFile = null which invokes the ImageProcessor to retry to save it
+ }
} catch ( IOException e ) {
continue;
+ // same thing here
}
infos.setCrcFile( crcFile );
uploadingImages.put( image.uuid, infos );