001    /*****************************************************************************
002     * Copyright (c) PicoContainer Organization. All rights reserved.            *
003     * ------------------------------------------------------------------------- *
004     * The software in this package is published under the terms of the BSD      *
005     * style license a copy of which has been included with this distribution in *
006     * the LICENSE.txt file.                                                     *
007     *                                                                           *
008     * Original code by Joerg Schaible                                           *
009     *****************************************************************************/
010    
011    package org.picocontainer.gems.adapters;
012    
013    import org.picocontainer.defaults.ObjectReference;
014    
015    import java.io.ObjectInputStream;
016    import java.io.ObjectOutputStream;
017    import java.io.Serializable;
018    
019    
020    /**
021     * An {@link org.picocontainer.defaults.ObjectReference} based on a {@link ThreadLocal}.
022     * 
023     * @author Jörg Schaible
024     */
025    public class ThreadLocalReference extends ThreadLocal implements ObjectReference, Serializable {
026    
027        private static final long serialVersionUID = 1L;
028    
029        private void writeObject(final ObjectOutputStream out) {
030            if(out != null); // eliminate warning because of unused parameter
031        }
032    
033        private void readObject(final ObjectInputStream in) {
034            if(in != null); // eliminate warning because of unused parameter
035        }
036    }