/[classpath]/classpath/java/nio/charset/CoderResult.java
ViewVC logotype

Diff of /classpath/java/nio/charset/CoderResult.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by mkoch, Mon Nov 18 21:34:15 2002 UTC revision 1.6 by tromey, Sat Nov 6 23:24:36 2004 UTC
# Line 1  Line 1 
1  /* CoderResult.java --  /* CoderResult.java --
2     Copyright (C) 2002 Free Software Foundation, Inc.     Copyright (C) 2002, 2004 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 82  public class CoderResult Line 82  public class CoderResult
82    private final int type;    private final int type;
83    private final int length;    private final int length;
84    
85    private CoderResult (int type, int length)    // Package-private to avoid a trampoline constructor.
86      CoderResult (int type, int length)
87    {    {
88      this.type = type;      this.type = type;
89      this.length = length;      this.length = length;
# Line 157  public class CoderResult Line 158  public class CoderResult
158    {    {
159      private final HashMap cache;      private final HashMap cache;
160    
161      private Cache ()      // Package-private to avoid a trampoline constructor.
162        Cache ()
163      {      {
164        // If we didn't synchronize on this, then cache would be initialized        cache = new HashMap ();
       // without holding a lock.  Undefined behavior would occur if the  
       // first thread to call get(int) was not the same as the one that  
       // called the constructor.  
       synchronized (this)  
         {  
           cache = new HashMap ();  
         }  
165      }      }
166    
167      private synchronized CoderResult get (int length)      // Package-private to avoid a trampoline.
168        synchronized CoderResult get (int length)
169      {      {
170        if (length <= 0)        if (length <= 0)
171          throw new IllegalArgumentException ("Non-positive length");          throw new IllegalArgumentException ("Non-positive length");

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26