com.tc.net
Class NIOWorkarounds

java.lang.Object
  extended by com.tc.net.NIOWorkarounds

public class NIOWorkarounds
extends java.lang.Object

Helper methods to work around various NIO issues on different platforms.


Method Summary
static boolean connectWorkaround(java.nio.channels.ClosedSelectorException cse)
          Determine whether to retry during connect
static boolean linuxSelectWorkaround(java.io.IOException ioe)
          Workaround bug in Sun VM when select() gets interrupted and throws IOException("Interrupted system call").
static void main(java.lang.String[] args)
          Apply Solaris 10 workaround if applicable.
static boolean selectorOpenRace(java.lang.NullPointerException npe)
          Determine whether the NPE should be ignored due to bug 6427854.
static void solaris10Workaround()
          Force use of poll based NIO selector on Solaris 10 to work around Sun bug 6322825.
static boolean windowsWritevWorkaround(java.io.IOException ioe)
          Determine whether this IOException should be ignored on Windows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

windowsWritevWorkaround

public static boolean windowsWritevWorkaround(java.io.IOException ioe)
Determine whether this IOException should be ignored on Windows. Checks for an IOException("A non-blocking socket operation could not be completed immediately") as in http://developer.java.sun.com/developer/bugParade/bugs/4854354.html.

Parameters:
ioe - Exception to check
Returns:
True if should be ignored on Windows

linuxSelectWorkaround

public static boolean linuxSelectWorkaround(java.io.IOException ioe)
Workaround bug in Sun VM when select() gets interrupted and throws IOException("Interrupted system call"). See Sun bug 4504001 (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4504001)

Parameters:
ioe - Exception to examine
Returns:
True if exception should be ignored on Linux

solaris10Workaround

public static void solaris10Workaround()
Force use of poll based NIO selector on Solaris 10 to work around Sun bug 6322825. This is done by setting the System property java.nio.channels.spi.SelectorProvider to "sun.nio.ch.PollSelectorProvider". The workaround is only applied on Solaris 10, JDK < 1.6. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6322825


selectorOpenRace

public static boolean selectorOpenRace(java.lang.NullPointerException npe)
Determine whether the NPE should be ignored due to bug 6427854. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6427854

Parameters:
npe - Exception to examine
Returns:
True if exception should be ignored

main

public static void main(java.lang.String[] args)
Apply Solaris 10 workaround if applicable.

Parameters:
args - Ignored

connectWorkaround

public static boolean connectWorkaround(java.nio.channels.ClosedSelectorException cse)
Determine whether to retry during connect

Parameters:
cse - Exception to examine
Returns:
True if should retry


Copyright © 2010 Terracotta, Inc.. All Rights Reserved.