/* 
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.felix.upnp.basedriver.importer.core.event.structs;


import java.util.Hashtable;

import org.apache.felix.upnp.basedriver.importer.core.event.thread.Renewer;

/* 
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class SidRenewer {
private Hashtable hash;

	/**
	 * @param hash
	 */
	public SidRenewer() {
		super();
		this.hash = new Hashtable();
	}

	public synchronized void put(String sid, Renewer renewer){
		hash.put(sid,renewer);
	}
	public synchronized Renewer get(String sid){
		return (Renewer)hash.get(sid);
	}
	public synchronized void remove(String sid){
		hash.remove(sid);
	}
}
