Skip to content

Commit 808a322

Browse files
author
Daan Hoogland
committed
remove code in comments
1 parent 14e1d98 commit 808a322

File tree

40 files changed

+29
-246
lines changed

40 files changed

+29
-246
lines changed

api/src/main/java/com/cloud/host/HostStats.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,4 @@ public interface HostStats {
3636
public HostStats getHostStats();
3737

3838
public double getLoadAverage();
39-
// public double getXapiMemoryUsageKBs();
4039
}

api/src/test/java/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ public void testCreateSuccess() {
7878
scaleVMCmd._responseGenerator = responseGenerator;
7979

8080
UserVmResponse userVmResponse = Mockito.mock(UserVmResponse.class);
81-
//List<UserVmResponse> list = Mockito.mock(UserVmResponse.class);
82-
//list.add(userVmResponse);
83-
//LinkedList<UserVmResponse> mockedList = Mockito.mock(LinkedList.class);
84-
//Mockito.when(mockedList.get(0)).thenReturn(userVmResponse);
8581

8682
List<UserVmResponse> list = new LinkedList<UserVmResponse>();
8783
list.add(userVmResponse);

core/src/main/java/com/cloud/network/HAProxyConfigurator.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,6 @@ public String[] generateConfiguration(final LoadBalancerConfigCommand lbCmd) {
597597
}
598598
}
599599
result.addAll(gSection);
600-
// TODO decide under what circumstances these options are needed
601-
// result.add("\tnokqueue");
602-
// result.add("\tnopoll");
603600

604601
result.add(blankLine);
605602
final List<String> dSection = Arrays.asList(defaultsSection);

engine/orchestration/src/main/java/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ public List<Host> listHosts() {
140140

141141
@Override
142142
public List<PodEntity> listPods() {
143-
/*
144-
* Not in use now, just commented out.
145-
*/
146-
//List<PodEntity> pods = new ArrayList<PodEntity>();
147-
//pods.add(new PodEntityImpl("pod-uuid-1", "pod1"));
148-
//pods.add(new PodEntityImpl("pod-uuid-2", "pod2"));
149143
return null;
150144
}
151145

engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDaoImpl.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
9999
private SearchBuilder<VMTemplateVO> PublicIsoSearch;
100100
private SearchBuilder<VMTemplateVO> UserIsoSearch;
101101
private GenericSearchBuilder<VMTemplateVO, Long> CountTemplatesByAccount;
102-
// private SearchBuilder<VMTemplateVO> updateStateSearch;
103102
private SearchBuilder<VMTemplateVO> AllFieldsSearch;
104103
protected SearchBuilder<VMTemplateVO> ParentTemplateIdSearch;
105104
private SearchBuilder<VMTemplateVO> InactiveUnremovedTmpltSearch;
@@ -403,12 +402,6 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
403402
CountTemplatesByAccount.and("state", CountTemplatesByAccount.entity().getState(), SearchCriteria.Op.EQ);
404403
CountTemplatesByAccount.done();
405404

406-
// updateStateSearch = this.createSearchBuilder();
407-
// updateStateSearch.and("id", updateStateSearch.entity().getId(), Op.EQ);
408-
// updateStateSearch.and("state", updateStateSearch.entity().getState(), Op.EQ);
409-
// updateStateSearch.and("updatedCount", updateStateSearch.entity().getUpdatedCount(), Op.EQ);
410-
// updateStateSearch.done();
411-
412405
AllFieldsSearch = createSearchBuilder();
413406
AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ);
414407
AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), SearchCriteria.Op.EQ);

framework/db/src/main/java/com/cloud/utils/db/GlobalLock.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,23 @@
2727

2828
import com.cloud.utils.Profiler;
2929

30-
//
31-
// Wrapper class for global database lock to reduce contention for database connections from within process
32-
//
33-
// Example of using dynamic named locks
34-
//
35-
// GlobalLock lock = GlobalLock.getInternLock("some table name" + rowId);
36-
//
37-
// if(lock.lock()) {
38-
// try {
39-
// do something
40-
// } finally {
41-
// lock.unlock();
42-
// }
43-
// }
44-
// lock.releaseRef();
45-
//
30+
/**
31+
* Wrapper class for global database lock to reduce contention for database connections from within process
32+
* This class is used to acquire a global lock for a specific operation, identified by a unique name.
33+
* Example of using dynamic named locks
34+
* <p>
35+
* GlobalLock lock = GlobalLock.getInternLock("some table name" + rowId);
36+
*
37+
* if(lock.lock()) {
38+
* try {
39+
* do something
40+
* } finally {
41+
* lock.unlock();
42+
* }
43+
* }
44+
* lock.releaseRef();
45+
* </p>
46+
*/
4647
public class GlobalLock {
4748
protected Logger logger = LogManager.getLogger(getClass());
4849

framework/db/src/test/java/com/cloud/utils/db/TransactionContextBuilderTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public class TransactionContextBuilderTest {
4141

4242
@Test
4343
public void test() {
44-
// _derived.DbAnnotatedMethod();
45-
// _base.MethodWithClassDbAnnotated();
46-
4744
// test @DB injection on dynamically constructed objects
4845
DbAnnotatedBase base = ComponentContext.inject(new DbAnnotatedBase());
4946
base.MethodWithClassDbAnnotated();

framework/ipc/src/test/java/org/apache/cloudstack/framework/codestyle/AsyncSampleEventDrivenStyleCaller.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
import java.util.concurrent.ExecutionException;
2222

23+
import org.apache.logging.log4j.LogManager;
24+
import org.apache.logging.log4j.Logger;
2325
import org.junit.Assert;
2426
import org.junit.Before;
2527
import org.junit.Test;
@@ -36,6 +38,7 @@
3638
@RunWith(SpringJUnit4ClassRunner.class)
3739
@ContextConfiguration(locations = "classpath:/SampleManagementServerAppContext.xml")
3840
public class AsyncSampleEventDrivenStyleCaller {
41+
protected Logger logger = LogManager.getLogger(getClass());
3942
private AsyncSampleCallee _ds;
4043
AsyncCallbackDriver _callbackDriver;
4144

@@ -53,12 +56,8 @@ public void MethodThatWillCallAsyncMethod() {
5356
try {
5457
String result = future.get();
5558
Assert.assertEquals(result, vol);
56-
} catch (InterruptedException e) {
57-
// TODO Auto-generated catch block
58-
e.printStackTrace();
59-
} catch (ExecutionException e) {
60-
// TODO Auto-generated catch block
61-
e.printStackTrace();
59+
} catch (InterruptedException | ExecutionException e) {
60+
logger.error(e);
6261
}
6362
}
6463

@@ -87,10 +86,8 @@ public String getResult() {
8786
if (!this.finished) {
8887
try {
8988
this.wait();
90-
9189
} catch (InterruptedException e) {
92-
// TODO Auto-generated catch block
93-
e.printStackTrace();
90+
logger.error(e);
9491
}
9592
}
9693
return this.result;

framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/dao/AsyncJobJoinMapDaoImpl.java

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ public class AsyncJobJoinMapDaoImpl extends GenericDaoBase<AsyncJobJoinMapVO, Lo
4444
private final SearchBuilder<AsyncJobJoinMapVO> CompleteJoinSearch;
4545
private final SearchBuilder<AsyncJobJoinMapVO> WakeupSearch;
4646

47-
// private final GenericSearchBuilder<AsyncJobJoinMapVO, Long> JoinJobSearch;
48-
4947
protected AsyncJobJoinMapDaoImpl() {
5048
RecordSearch = createSearchBuilder();
5149
RecordSearch.and("jobId", RecordSearch.entity().getJobId(), Op.EQ);
@@ -65,10 +63,6 @@ protected AsyncJobJoinMapDaoImpl() {
6563
WakeupSearch.and("expiration", WakeupSearch.entity().getExpiration(), Op.GT);
6664
WakeupSearch.and("joinStatus", WakeupSearch.entity().getJoinStatus(), Op.EQ);
6765
WakeupSearch.done();
68-
69-
// JoinJobSearch = createSearchBuilder(Long.class);
70-
// JoinJobSearch.and(JoinJobSearch.entity().getJoinJobId(), Op.SC, "joinJobId");
71-
// JoinJobSearch.done();
7266
}
7367

7468
@Override
@@ -148,64 +142,6 @@ public void completeJoin(long joinJobId, JobInfo.Status joinStatus, String joinR
148142
update(ub, sc, null);
149143
}
150144

151-
// @Override
152-
// public List<Long> wakeupScan() {
153-
// List<Long> standaloneList = new ArrayList<Long>();
154-
//
155-
// Date cutDate = DateUtil.currentGMTTime();
156-
//
157-
// TransactionLegacy txn = TransactionLegacy.currentTxn();
158-
// PreparedStatement pstmt = null;
159-
// try {
160-
// txn.start();
161-
//
162-
// //
163-
// // performance sensitive processing, do it in plain SQL
164-
// //
165-
// String sql = "UPDATE async_job SET job_pending_signals=? WHERE id IN " +
166-
// "(SELECT job_id FROM async_job_join_map WHERE next_wakeup < ? AND expiration > ?)";
167-
// pstmt = txn.prepareStatement(sql);
168-
// pstmt.setInt(1, AsyncJob.Constants.SIGNAL_MASK_WAKEUP);
169-
// pstmt.setString(2, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
170-
// pstmt.setString(3, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
171-
// pstmt.executeUpdate();
172-
// pstmt.close();
173-
//
174-
// sql = "UPDATE sync_queue_item SET queue_proc_msid=NULL, queue_proc_number=NULL WHERE content_id IN " +
175-
// "(SELECT job_id FROM async_job_join_map WHERE next_wakeup < ? AND expiration > ?)";
176-
// pstmt = txn.prepareStatement(sql);
177-
// pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
178-
// pstmt.setString(2, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
179-
// pstmt.executeUpdate();
180-
// pstmt.close();
181-
//
182-
// sql = "SELECT job_id FROM async_job_join_map WHERE next_wakeup < ? AND expiration > ? AND job_id NOT IN (SELECT content_id FROM sync_queue_item)";
183-
// pstmt = txn.prepareStatement(sql);
184-
// pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
185-
// pstmt.setString(2, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
186-
// ResultSet rs = pstmt.executeQuery();
187-
// while(rs.next()) {
188-
// standaloneList.add(rs.getLong(1));
189-
// }
190-
// rs.close();
191-
// pstmt.close();
192-
//
193-
// // update for next wake-up
194-
// sql = "UPDATE async_job_join_map SET next_wakeup=DATE_ADD(next_wakeup, INTERVAL wakeup_interval SECOND) WHERE next_wakeup < ? AND expiration > ?";
195-
// pstmt = txn.prepareStatement(sql);
196-
// pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
197-
// pstmt.setString(2, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
198-
// pstmt.executeUpdate();
199-
// pstmt.close();
200-
//
201-
// txn.commit();
202-
// } catch (SQLException e) {
203-
// logger.error("Unexpected exception", e);
204-
// }
205-
//
206-
// return standaloneList;
207-
// }
208-
209145
@Override
210146
public List<Long> findJobsToWake(long joinedJobId) {
211147
// TODO: We should fix this. We shouldn't be crossing daos in a dao code.

framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/JobSerializerHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ public JsonElement serialize(Throwable th, Type type, JsonSerializationContext c
193193
json.add("class", new JsonPrimitive(th.getClass().getName()));
194194
json.add("cause", s_gson.toJsonTree(th.getCause()));
195195
json.add("msg", new JsonPrimitive(th.getMessage()));
196-
// json.add("stack", s_gson.toJsonTree(th.getStackTrace()));
197196

198197
return json;
199198
}

0 commit comments

Comments
 (0)