Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M Finkbeiner2013-08-13 22:12:51 +0000
committerRoberto E. Escobar2013-08-19 22:10:24 +0000
commita7b782b3830ca594e836649c013309ba8c8f0327 (patch)
tree7c1e70ae85018761fcb5eb2af8154ecf5caa8241
parenta9d2289474882dc8febe180bfe91302f0ca1a181 (diff)
downloadorg.eclipse.osee-a7b782b3830ca594e836649c013309ba8c8f0327.tar.gz
org.eclipse.osee-a7b782b3830ca594e836649c013309ba8c8f0327.tar.xz
org.eclipse.osee-a7b782b3830ca594e836649c013309ba8c8f0327.zip
feature[ats_YTDM5]: Remove foreach loops
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/GCHelper.java12
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/Message.java7
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/instrumentation/BaseIOInstrumentation.java6
-rw-r--r--plugins/org.eclipse.osee.ote.messaging.dds/src/org/eclipse/osee/ote/messaging/dds/entity/DataWriter.java7
4 files changed, 25 insertions, 7 deletions
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/GCHelper.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/GCHelper.java
index dbaca447dd..5018c99795 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/GCHelper.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/GCHelper.java
@@ -17,6 +17,7 @@ import java.util.Map;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
+
import org.eclipse.osee.framework.logging.OseeLog;
/**
@@ -24,6 +25,8 @@ import org.eclipse.osee.framework.logging.OseeLog;
*/
public class GCHelper {
+ private static boolean enableGcHelper = Boolean.parseBoolean(System.getProperty("ote.gc.helper", "false"));
+
private final ConcurrentHashMap<String, WeakReference<Object>> map;
private static GCHelper singleton;
@@ -40,13 +43,18 @@ public class GCHelper {
}
public void addRefWatch(Object obj) {
- String key = obj.toString() + " [ " + obj.hashCode() + " ] ";
- map.put(key, new WeakReference<Object>(obj));
+ if(enableGcHelper){
+ String key = obj.toString() + " [ " + obj.hashCode() + " ] ";
+ map.put(key, new WeakReference<Object>(obj));
+ }
}
public void printLiveReferences() {
StringBuilder builder = new StringBuilder(8000);
+ if(!enableGcHelper){
+ builder.append("GCHelper disabled. Enable with '-Dote.gc.helper=true'\n");
+ }
writeGCResults(builder);
OseeLog.log(GCHelper.class, Level.INFO, builder.toString());
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/Message.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/Message.java
index 47d62250fe..27654166b3 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/Message.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/Message.java
@@ -268,10 +268,11 @@ public abstract class Message<S extends ITestEnvironmentMessageSystemAccessor, T
public void send() throws MessageSystemException {
checkState();
if (!isTurnedOff) {
- Collection<T> dataList = memToDataMap.get(currentMemType);
+ ArrayList<T> dataList = memToDataMap.get(currentMemType);
if (dataList != null) {
- for (T data : dataList) {
- data.send();
+ int listSize = dataList.size();
+ for (int i = 0; i < listSize; i++) {
+ dataList.get(i).send();
}
} else {
throw new MessageSystemException(
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/instrumentation/BaseIOInstrumentation.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/instrumentation/BaseIOInstrumentation.java
index 1b29179cee..c503f5adb4 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/instrumentation/BaseIOInstrumentation.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/instrumentation/BaseIOInstrumentation.java
@@ -17,6 +17,7 @@ import java.nio.channels.DatagramChannel;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
+
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.ote.message.MessageSystemTestEnvironment;
@@ -62,9 +63,10 @@ public class BaseIOInstrumentation implements IOInstrumentation {
public void send(ByteBuffer bytes) {
bytes.mark();
- for (InetSocketAddress address : addresses) {
+ int size = addresses.size();
+ for (int i = 0; i < size; i++) {
try {
- channel.send(bytes, address);
+ channel.send(bytes, addresses.get(i));
bytes.reset();
} catch (Exception ex) {
OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, ex.toString(), ex);
diff --git a/plugins/org.eclipse.osee.ote.messaging.dds/src/org/eclipse/osee/ote/messaging/dds/entity/DataWriter.java b/plugins/org.eclipse.osee.ote.messaging.dds/src/org/eclipse/osee/ote/messaging/dds/entity/DataWriter.java
index c2f42a8a77..80095954fa 100644
--- a/plugins/org.eclipse.osee.ote.messaging.dds/src/org/eclipse/osee/ote/messaging/dds/entity/DataWriter.java
+++ b/plugins/org.eclipse.osee.ote.messaging.dds/src/org/eclipse/osee/ote/messaging/dds/entity/DataWriter.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.ote.messaging.dds.entity;
import java.util.Collection;
+
import org.eclipse.osee.ote.messaging.dds.Data;
import org.eclipse.osee.ote.messaging.dds.DataSample;
import org.eclipse.osee.ote.messaging.dds.DataStoreItem;
@@ -53,6 +54,12 @@ public class DataWriter extends DomainEntity {
topic.addDataWriter(this);
}
+
+ public DataWriter(){
+ super(true, null, null);
+ topic = null;
+ publisher = null;
+ }
/**
* Provides access to the deletion flag for this <code>DataReader</code>.

Back to the top