public static synchronized String generate(int lifespan)
public static synchronized String generate(String suffix, int lifespan)
	public static synchronized String generate(int lifespan)	{		String retval;		int random = (int)(Math.random() * 100000);		long now = System.currentTimeMillis();		long expiry = now + lifespan;		/*		 * Delete any previously generated temporary files that have expired.		 */		if (!mGeneratedFilenames.isEmpty())		{			TransientFile expired = (TransientFile)(mGeneratedFilenames.getFirst());			while (expired != null && now >= expired.mExpiryTimestamp)			{				File f = new File(expired.mFilename);				f.delete();					mGeneratedFilenames.removeFirst();					if (mGeneratedFilenames.isEmpty())					expired = null;				else					expired = (TransientFile)(mGeneratedFilenames.getFirst());			}		}		/*		 * Include random number in filename to		 * make it unpredictable.		 */		retval = "tmp" + mCounter + "a" + random;		mCounter++;		/*		 * Insert newly created filename into list,		 * maintaining the list in order of expiry.		 */		ListIterator li = mGeneratedFilenames.listIterator();		int insertIndex = 0;		boolean found = false;		if (!mGeneratedFilenames.isEmpty())		{			/*			 * If entry expires at a later time than all other files we've			 * generated then we can just add it to end of list.			 */			TransientFile t = (TransientFile)(mGeneratedFilenames.getLast());			if (t.mExpiryTimestamp <= expiry)			{				found = true;				insertIndex = mGeneratedFilenames.size();			}		}		while (found == false && li.hasNext())		{			TransientFile t = (TransientFile)(li.next());			if (t.mExpiryTimestamp > expiry)			{				insertIndex = li.nextIndex() - 1;				found = true;			}		}		TransientFile t = new TransientFile(retval, expiry);		if (found)			mGeneratedFilenames.add(insertIndex, t);		else			mGeneratedFilenames.addLast(t);		return(retval);	}