[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: ANTS question



> Hi,Timothy
>     
>  I am afraid I did not for expresse the question=
>  clearly.Sorry.
> 
> As we know,capsule can deside where to go by executing the=
>  evaluate() method.That 
> is to say,we can always use if statement in the evaluate():when=
>  the expression is true ,the capsule should go Node A;when false=
>  ,the capsule should go another Node,node B...
> 
> In my AA, the capsule will read a local file in the evaluate()=
>  method (I have modified the ants code to do this)and decide the=
>  next destination node accordingly.This file is filled by a linux=
>  module.So when the capsule arrived,the file may not contain=
>  meaningful infomation. My question is ,when this happened,how=
>  long could this capsule wait before the file  is filled by the=
>  module?

The evaluate() method can execute arbitrary java code, so it will wait as
long as you want.  I don't know how your modifications work, but, besides
extending ANTS to support files, you'll also need to have some simple
signalling protocol between the module and the AA.  Or, you just
continously poll the file until it has the data you want.

  {
    synchronized( this )
    {
      while( !file.isReady() )
      {
	this.wait(500); // Wait half a second before testing again...
      }
    }
  }

>     thanks
> 
>     Jianfeng Liu

tim stack




[ Janos ] [ OSKit ] [ Network Testbed ] [ Flick ] [ Fluke ]
Flux Research Group / Department of Computer Science / University of Utah