001/* 002 * Copyright (c) 1999-2001 Keiron Liddle, Aftex Software 003 * 004 * This library is free software; you can redistribute it and/or 005 * modify it under the terms of the GNU Lesser General Public 006 * License as published by the Free Software Foundation; either 007 * version 2.1 of the License, or (at your option) any later version. 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014*/ 015package com.aftexsw.util; 016 017public class PerishTimer extends Thread { 018 public PerishTimer(Perishable inPerishable, long inLife) { 019 perishable = inPerishable; 020 lifetime = inLife; 021 } 022 023 public void run() { 024 synchronized(this) { 025 try { 026 wait(lifetime); 027 } catch(Exception e) {} 028 } 029 perishable.perish(); 030 } 031 032 long lifetime; 033 private Perishable perishable; 034}