/*
 *   Copyright 2009-2010 Joubin Houshyar
 * 
 *   Licensed 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.jredis;

import java.io.Serializable;
import java.lang.ref.WeakReference;

/**
 * Generic Event class for JRedis and sub-modules.
 * @author  Joubin Houshyar (alphazero@sensesay.net)
 * @version alpha.0, Mar 29, 2010
 * @since   alpha.0
 * 
 * @param <SRC>
 * @param <ETYPE>
 * @param <INFO>
 */
public class Event <SRC, ETYPE, INFO> implements Serializable{
	/**  */
    private static final long serialVersionUID = 1L;
    
	/**  */
	private final ETYPE type;
	/**  */
	private final WeakReference<SRC> srcRef;
	/**  */
	private final INFO info;
	
	/**
	 * @param src
	 * @param eType
	 * @param info
	 */
	protected Event(SRC src, ETYPE eType, INFO info){
		this.type = eType;
		this.srcRef = new WeakReference<SRC>(src);
		this.info = info;
	}
	/**
	 * @param src
	 * @param eType
	 */
	protected Event(SRC src, ETYPE eType){
		this(src, eType, null);
	}
	/**
	 * @return
	 */
	public ETYPE getType () {
    	return type;
    }
	/**
	 * @return
	 */
	public SRC getSource () {
    	return srcRef.get();
    }
	/**
	 * @return
	 */
	public INFO getInfo () {
    	return info;
    }
}
@@ -644,16 +644,113 @@
 redis;%0A%0A
+import java.io.IOException;%0Aimport java.io.ObjectInputStream;%0Aimport java.io.ObjectOutputStream;%0A
 import j
@@ -770,16 +770,16 @@
 izable;%0A
-
 import j
@@ -1212,21 +1212,25 @@
 private 
-final
+transient
  WeakRef
@@ -1815,15 +1815,362 @@
 n info;%0A
-
     %7D
+%0A%0A%09private void writeObject(ObjectOutputStream out) throws IOException %7B%0A%09%09out.defaultWriteObject();%0A%09%09out.writeObject(srcRef.get());%0A%09%7D%0A%0A%09@SuppressWarnings(%22unchecked%22)%0A%09private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException %7B%0A%09%09in.defaultReadObject();%0A%09%09srcRef = new WeakReference%3CSRC%3E((SRC)in.readObject());%0A%09%7D
 %0A%7D

Fix serialization; can't serialize a WeakReference