> Date: Wed, 02 Feb 2011 11:09:40 +0100
> From: Dennis Neumann <[email protected]>
> To: List for general discussion and hacking of the Taverna project
> > <[email protected]>
> Subject: [Taverna-hackers]  global variable for beanshells

> Hi,

Hello

> never mind, the normal variables seem to be already global in my case. 
> This did the trick:

> if(currentTime == void){
>   currentTime = new Date().getTime();
> }

It's not safe to assume that the normal variables will remain set.
It's an artifact of using the same beanshell interpreter and the
variables not being cleared.  The variables not being cleared is down
as a bug.

You can do something similar to what you want with:

Date currentTime;

String currentTimeString = System.getProperty("mytime");
if(currentTimeString == null){
  currentTime = new Date();
  currentTimeString = Long.toString(currentTime.getTime());
  System.setProperty("mytime", currentTimeString);
}
else {
  currentTime = new Date(Long.parseLong(currentTimeString));
}
out1 = currentTime.toString();
out2 = currentTime.getTime();

> Cheers,
> Dennis

Alan

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
taverna-hackers mailing list
[email protected]
Web site: http://www.taverna.org.uk
Mailing lists: http://www.taverna.org.uk/about/contact-us/
Developers Guide: http://www.taverna.org.uk/developers/

Reply via email to