Java FileLock openTcpSocket(boolean blocking)

Here you can find the source of openTcpSocket(boolean blocking)

Description

Open and return a socket channel with the specified blocking mode enabled or null if there is an error opening the channel.

License

Open Source License

Declaration

public static SocketChannel openTcpSocket(boolean blocking) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.nio.channels.SocketChannel;

public class Main {
    /**/*  ww  w.  j  a  va2s  .com*/
     * Open and return a socket channel with the specified blocking mode enabled or
     * {@code null} if there is an error opening the channel.
     */
    public static SocketChannel openTcpSocket(boolean blocking) {
        try {
            return (SocketChannel) SocketChannel.open().configureBlocking(blocking);
        } catch (Exception ex) {
            return null;
        }
    }
}

Related

  1. isLocked(File file)
  2. lock(File file)
  3. lockFile(File file)
  4. lockFile(File file, RandomAccessFile raf)
  5. lockFileExists(File file)
  6. pauseForLock(File f, int frequency, int totalTime)
  7. releaseQuietly(FileLock lock)
  8. releaseQuietly(final FileLock lock)
  9. releaseSilent(FileLock fileLock)