Commit 969add23 authored by Florian Fittkau's avatar Florian Fittkau

reduced waiting CPU impact

parent 9fb93bc6
......@@ -11,7 +11,6 @@ import java.util.Queue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;
import org.aspectj.lang.Signature;
......@@ -77,9 +76,9 @@ public class MonitoringController implements IPeriodicTimeSignalReceiver {
configuration.getIntProperty(ConfigurationFactory.LOAD_BALANCER_PORT, 9999),
configuration.getIntProperty(ConfigurationFactory.LOAD_BALANCER_WAIT_TIME,
20000),
configuration
configuration
.getStringProperty(ConfigurationFactory.LOAD_BALANCER_SCALING_GROUP),
tcpWriter);
tcpWriter);
} else {
try {
tcpWriter.connect();
......@@ -141,7 +140,10 @@ public class MonitoringController implements IPeriodicTimeSignalReceiver {
}
while (!queue.offer(bufferEvent)) {
LockSupport.parkNanos(1);
try {
Thread.sleep(1);
} catch (final InterruptedException e) {
}
}
}
......
......@@ -8,7 +8,6 @@ import java.net.URL;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.util.concurrent.locks.LockSupport;
import explorviz.live_trace_processing.configuration.Configuration;
import explorviz.live_trace_processing.configuration.ConfigurationFactory;
......@@ -186,7 +185,10 @@ public class TCPWriter extends Thread implements IPipeReceiver<ByteBufferEvent>,
final ByteBuffer buffer = event.getValue();
buffer.flip();
while ((socketChannel == null) || (!socketChannel.isConnected()) || !metaDataSent) {
LockSupport.parkNanos(1);
try {
Thread.sleep(1);
} catch (final InterruptedException e) {
}
if (androidMonitoring) {
try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment