KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > spring > bean > CrashSingleton


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tctest.spring.bean;
5
6 public class CrashSingleton {
7   private volatile int counter = 0;
8
9   synchronized public int getCounter() {
10     return counter;
11   }
12   
13   synchronized public void incrementCounter() {
14       this.counter++;
15   }
16   
17   public String JavaDoc toString() {
18     return "CrashSingleton:"+counter;
19   }
20 }
21
Popular Tags