factoryBean.setServiceInterface(Browsable.class);
factoryBean.setServiceUrl("http://localhost:8888/bobo-service/services/BrowseService");
factoryBean.afterPropertiesSet();
final Browsable svc = (Browsable) (factoryBean.getObject());
int numThreads = 1;
Thread[] threads = new Thread[numThreads];
for (int i = 0; i < threads.length; ++i)
{
threads[i] = new Thread()
{
public void run()
{
for (BrowseRequest req : reqs)
{
try
{
long start = System.currentTimeMillis();
BrowseResult result = svc.browse(req);
long end = System.currentTimeMillis();
long time = result.getTime();
System.out.println("took: (c):" + (end - start) + " / (s):" + time);
Thread.sleep(200);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
public void run2()
{
while (true)
{
try
{
BrowseRequest req = new BrowseRequest();
BrowseSelection sel = new BrowseSelection("color");
sel.addValue("red");
req.addSelection(sel);
FacetSpec fspec = new FacetSpec();
fspec.setExpandSelection(true);
fspec.setMaxCount(10);
fspec.setOrderBy(FacetSortSpec.OrderHitsDesc);
req.setFacetSpec("color", fspec);
req.setFacetSpec("category", fspec);
req.setFacetSpec("makemodel", fspec);
req.setFacetSpec("city", fspec);
req.setFacetSpec("price", fspec);
req.setFacetSpec("year", fspec);
long start = System.currentTimeMillis();
BrowseResult result = svc.browse(req);
long end = System.currentTimeMillis();
long time = result.getTime();
System.out.println("took: (c):" + (end - start) + " / (s):" + time);
Thread.sleep(200);