View Javadoc

1   /***
2    *  Copyright 2003-2010 Terracotta, Inc.
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.IOException;
20  import java.io.Serializable;
21  
22  
23  /***
24   * A class which throws a RuntimeException when serialized or deserialized. This
25   * should be enough to kill threads that do not have special handling.
26   *
27   * @author Greg Luck
28   * @version $Id: ThreadKiller.html 13146 2011-08-01 17:12:39Z oletizi $
29   */
30  public class ThreadKiller extends Object implements Serializable {
31  
32      private static final long serialVersionUID = 293659559026635155L;
33  
34      private void writeObject(java.io.ObjectOutputStream out)
35              throws IOException {
36          throw new Error("Thread killer strikes");
37  
38      }
39  
40      private void readObject(java.io.ObjectInputStream in)
41              throws IOException, ClassNotFoundException {
42          throw new Error("Thread killer strikes");
43      }
44  
45  }