Commit 06de78c0 authored by James Hughes's avatar James Hughes
Browse files

Fixed bug where the tests would not start. Increased the SwingWorker

thread count. 
parent e51bae90
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -120,9 +120,9 @@ public class KineticBench extends SwingWorker<Object, Object> {
			String host = dev.inet4.get(0);
			ClientConfiguration cc = new ClientConfiguration();
			cc.setHost(host);
			log.finest("Connecting to " + host);
			log.info("Connecting to " + host);
			c = AdvancedKineticClientFactory.createAdvancedClientInstance(cc);
//			log.finest("Connected  to " + host);
			log.info("Connected  to " + host);
			if (c == null)
				throw new Error("really?");

@@ -155,6 +155,7 @@ public class KineticBench extends SwingWorker<Object, Object> {
	}

	KineticBench(KineticDevice dev, String order, String rw, String size) {
				
		this.dev = dev;
		this.stat = dev.stat;

+18 −2
Original line number Diff line number Diff line
@@ -2,9 +2,15 @@ package com.jim;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.SwingWorker;

/**
 * A demonstration application showing a time series chart where you can
 * dynamically add (random) data by clicking on a button.
@@ -13,12 +19,22 @@ class KineticDemo1 {

	static Logger log = MyLogger.get(Level.INFO, Level.INFO);
	
	@SuppressWarnings("restriction")
	public static void main(String[] args) throws Exception {

		// The following code was suggested from 
		// http://stackoverflow.com/questions/8356784/whats-the-maximum-number-of-swing-worker-threads-that-can-be-run
		final int corePoolSize = 100;
		final int maximumPoolSize = 100;
		final long keepAliveTime = 100000;
		final TimeUnit unit = TimeUnit.SECONDS;
		final BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<>(maximumPoolSize);
		sun.awt.AppContext.getAppContext().put(SwingWorker.class,
		                 new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue));
		
		Map<String, Stat> stats = new HashMap<String, Stat>();
		new Dial("asdf", stats);
		KineticDiscovery.findAll(stats);
	
		
	}
}
+1 −1

File changed.

Contains only whitespace changes.