View Javadoc

1   /**
2    *  Copyright 2003-2006 Greg Luck
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  
17  package net.sf.ehcache;
18  
19  import java.io.Serializable;
20  import java.io.IOException;
21  
22  
23  /**
24   *
25   * A class which throws a RuntimeException when serialized or deserialized. This
26   * should be enough to kill threads that do not have special handling.
27   *
28   * @author Greg Luck
29   * @version $Id: ThreadKiller.java 137 2006-06-28 10:33:09Z gregluck $
30   */
31  public class ThreadKiller extends Object implements Serializable {
32  
33      private static final long serialVersionUID = 293659559026635155L;
34  
35      private void writeObject(java.io.ObjectOutputStream out)
36              throws IOException {
37          throw new Error("Thread killer strikes");
38  
39      }
40  
41      private void readObject(java.io.ObjectInputStream in)
42              throws IOException, ClassNotFoundException {
43          throw new Error("Thread killer strikes");
44      }
45  
46  }
47