/** * Get the resolved host name. */ public String getHostName() { if(hostnamefut!=null) { this.hostname = hostnamefut.get(new ThreadSuspendable()); this.hostnamefut = null; } return hostname; }
timeout = getDefaultTimeout(); ThreadPool.WAITING_THREADS.remove(Thread.currentThread()); afterSwitch(); this.future = null;
/** * Resume the execution of the suspendable. */ public void resume(Future<?> future) { synchronized(this) { // Only wake up if still waiting for same future (invalid resume might be called from outdated future after timeout already occurred). if(future==this.future) { // Save the thread local values before switch beforeSwitch(); this.notify(); } } }
/** * Called when web service is called. * Redirects to Jadex service method and * synchronously waits for reply. */ public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { Object ret = null; try { Method m = service.getClass().getMethod(method.getName(), method.getParameterTypes()); ret = m.invoke(service, args); if(ret instanceof IFuture) { ret = ((IFuture)ret).get(new ThreadSuspendable()); } } catch(Exception e) { throw new RuntimeException(e); } return ret; }
IComponentIdentifier cid = cms.createComponent(null, filename, null, null).get(new ThreadSuspendable()); try cms.destroyComponent(cid).get(new ThreadSuspendable()); System.out.println("killed: "+filename);
updated.get(new ThreadSuspendable());
if(caller==null) caller = new ThreadSuspendable();
if(caller==null) caller = new ThreadSuspendable();
if(caller==null) caller = new ThreadSuspendable();
msg.getFuture().get(new ThreadSuspendable(), 30000); // todo: how to set a useful timeout value!? sent = true;
if(caller==null) caller = new ThreadSuspendable();
if(caller==null) caller = new ThreadSuspendable();
ISuspendable caller = ISuspendable.SUSPENDABLE.get(); if(caller==null) caller = new ThreadSuspendable();
/** * */ public static void main(String[] args) { String[] pargs = new String[] { "-gui", "false" }; IExternalAccess rootcomp = (IExternalAccess)Starter.createPlatform(pargs).get(new ThreadSuspendable()); IComponentManagementService cms = (IComponentManagementService)SServiceProvider.getServiceUpwards(rootcomp.getServiceProvider(), IComponentManagementService.class).get(new ThreadSuspendable()); dorun(cms, "jadex/micro/testcases/blocking/ShutdownAgent.class"); // dorun(cms, "jadex/micro/benchmarks/MessagePerformanceAgent.class"); // dorun(cms, "jadex/micro/examples/ping/PingScenario.application.xml"); } }
ISuspendable.SUSPENDABLE.set(new ThreadSuspendable()); createPlatform(args).get();
disposed.get(new ThreadSuspendable(), BasicService.getLocalDefaultTimeout());
if(ret instanceof IFuture) ret = ((IFuture<?>)ret).get(new ThreadSuspendable());
/** * Called after test suite is finished. */ protected void cleanup(TestResult result) { try { platform.killComponent().get(new ThreadSuspendable()); } catch(Exception e) { result.addError(this, e); } platform = null; clearAWT(); stopTimer(); }
ISuspendable.SUSPENDABLE.set(new ThreadSuspendable()); ITuple2Future<IComponentIdentifier, Map<String, Object>> fut = cms.createComponent(null, comp.getFilename(), new CreationInfo(comp.getResourceIdentifier())); Map<String, Object> res = fut.getSecondResult();