2222import java .util .NoSuchElementException ;
2323import java .util .Optional ;
2424import javax .annotation .Nullable ;
25- import org .slf4j .Logger ;
26- import org .slf4j .LoggerFactory ;
2725
2826/** The generic DAO that is used to scan ScalarDB data */
2927public class ScalarDbDao {
3028
31- /* Class logger */
32- private static final Logger logger = LoggerFactory .getLogger (ScalarDbDao .class );
33- private static final String GET_COMPLETED_MSG = "GET completed for %s" ;
34- private static final String PUT_COMPLETED_MSG = "PUT completed for %s" ;
35- private static final String SCAN_START_MSG = "SCAN started..." ;
36- private static final String SCAN_END_MSG = "SCAN completed" ;
37-
3829 /**
3930 * Retrieve record from ScalarDB instance in storage mode
4031 *
@@ -59,9 +50,7 @@ public Optional<Result> get(
5950
6051 try {
6152 Get get = createGetWith (namespace , table , partitionKey , clusteringKey );
62- Optional <Result > result = storage .get (get );
63- logger .info (String .format (GET_COMPLETED_MSG , loggingKey ));
64- return result ;
53+ return storage .get (get );
6554 } catch (ExecutionException e ) {
6655 throw new ScalarDbDaoException ("error GET " + loggingKey , e );
6756 }
@@ -90,9 +79,7 @@ public Optional<Result> get(
9079 // Retrieving the key data for logging
9180 String loggingKey = keysToString (partitionKey , clusteringKey );
9281 try {
93- Optional <Result > result = transaction .get (get );
94- logger .info (String .format (GET_COMPLETED_MSG , loggingKey ));
95- return result ;
82+ return transaction .get (get );
9683 } catch (CrudException e ) {
9784 throw new ScalarDbDaoException ("error GET " + loggingKey , e .getCause ());
9885 }
@@ -125,7 +112,6 @@ public void put(
125112 throw new ScalarDbDaoException (
126113 CoreError .DATA_LOADER_ERROR_CRUD_EXCEPTION .buildMessage (e .getMessage ()), e );
127114 }
128- logger .info (String .format (PUT_COMPLETED_MSG , keysToString (partitionKey , clusteringKey )));
129115 }
130116
131117 /**
@@ -154,7 +140,6 @@ public void put(
154140 throw new ScalarDbDaoException (
155141 CoreError .DATA_LOADER_ERROR_CRUD_EXCEPTION .buildMessage (e .getMessage ()), e );
156142 }
157- logger .info (String .format (PUT_COMPLETED_MSG , keysToString (partitionKey , clusteringKey )));
158143 }
159144
160145 /**
@@ -186,11 +171,8 @@ public List<Result> scan(
186171
187172 // scan data
188173 try {
189- logger .info (SCAN_START_MSG );
190174 try (Scanner scanner = storage .scan (scan )) {
191- List <Result > allResults = scanner .all ();
192- logger .info (SCAN_END_MSG );
193- return allResults ;
175+ return scanner .all ();
194176 }
195177 } catch (ExecutionException | IOException e ) {
196178 throw new ScalarDbDaoException (
@@ -229,10 +211,7 @@ public List<Result> scan(
229211
230212 // scan data
231213 try {
232- logger .info (SCAN_START_MSG );
233- List <Result > results = transaction .scan (scan );
234- logger .info (SCAN_END_MSG );
235- return results ;
214+ return transaction .scan (scan );
236215 } catch (CrudException | NoSuchElementException e ) {
237216 // No such element Exception is thrown when the scan is done in transaction mode but
238217 // ScalarDB is running in storage mode
0 commit comments