/[classpath]/classpath/java/nio/channels/spi/SelectorProvider.java
ViewVC logotype

Diff of /classpath/java/nio/channels/spi/SelectorProvider.java

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

revision 1.7 by mkoch, Mon Mar 3 07:09:20 2003 UTC revision 1.8 by mkoch, Sun Oct 12 16:56:00 2003 UTC
# Line 1  Line 1 
1  /* SelectorProvider.java  /* SelectorProvider.java
2     Copyright (C) 2002 Free Software Foundation, Inc.     Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 50  import java.nio.channels.SocketChannel; Line 50  import java.nio.channels.SocketChannel;
50   */   */
51  public abstract class SelectorProvider  public abstract class SelectorProvider
52  {  {
53    static SelectorProvider pr;    private static SelectorProvider systemDefaultProvider;
54            
55    /**    /**
56     * Initializes the selector provider.     * Initializes the selector provider.
# Line 95  public abstract class SelectorProvider Line 95  public abstract class SelectorProvider
95     * Returns the system-wide default selector provider for this invocation     * Returns the system-wide default selector provider for this invocation
96     * of the Java virtual machine.     * of the Java virtual machine.
97     */     */
98    public static SelectorProvider provider ()    public static synchronized SelectorProvider provider ()
99    {    {
100      if (pr == null)      if (systemDefaultProvider == null)
101        {        {
102          pr = new SelectorProviderImpl ();          String propertyValue =
103              System.getProperty ("java.nio.channels.spi.SelectorProvider");
104    
105            if (propertyValue == null
106                || propertyValue.equals (""))
107              systemDefaultProvider = new SelectorProviderImpl();
108            else
109              {
110                try
111                  {
112                    systemDefaultProvider = (SelectorProvider) Class.forName
113                      (propertyValue).newInstance();
114                  }
115                catch (Exception e)
116                  {
117                    System.err.println ("Could not instantiate class: "
118                                        + propertyValue);
119                    systemDefaultProvider = new SelectorProviderImpl();
120                  }
121              }
122        }        }
123            
124      return pr;      return systemDefaultProvider;
125    }    }
126  }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

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