001/* 002 * This file is part of the Kompics component model runtime. 003 * 004 * Copyright (C) 2009 Swedish Institute of Computer Science (SICS) 005 * Copyright (C) 2009 Royal Institute of Technology (KTH) 006 * 007 * Kompics is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU General Public License 009 * as published by the Free Software Foundation; either version 2 010 * of the License, or (at your option) any later version. 011 * 012 * This program is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 015 * GNU General Public License for more details. 016 * 017 * You should have received a copy of the GNU General Public License 018 * along with this program; if not, write to the Free Software 019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 020 */ 021package se.sics.kompics.timer; 022 023import java.util.UUID; 024 025import se.sics.kompics.Response; 026 027/** 028 * The <code>Timeout</code> class. 029 * 030 * @author Cosmin Arad {@literal <[email protected]>} 031 * @author Jim Dowling {@literal <[email protected]>} 032 * @version $Id$ 033 */ 034@SuppressWarnings("deprecation") 035public abstract class Timeout extends Response implements Cloneable { 036 037 private UUID timeoutId; 038 039 /** 040 * Instantiates a new timeout. 041 * 042 * @param request 043 * the request 044 */ 045 protected Timeout(ScheduleTimeout request) { 046 super(request); 047 timeoutId = UUID.randomUUID(); 048 } 049 050 /** 051 * Instantiates a new timeout. 052 * 053 * @param request 054 * the request 055 */ 056 protected Timeout(SchedulePeriodicTimeout request) { 057 super(request); 058 timeoutId = UUID.randomUUID(); 059 } 060 061 /** 062 * Gets the timeout id. 063 * 064 * @return the timeout id 065 */ 066 public final UUID getTimeoutId() { 067 return timeoutId; 068 } 069 070 /* 071 * (non-Javadoc) 072 * 073 * @see se.sics.kompics.Response#clone() 074 */ 075 @Override 076 public final Object clone() throws CloneNotSupportedException { 077 Timeout timeout = (Timeout) super.clone(); 078 timeout.timeoutId = timeoutId; 079 return timeout; 080 } 081}