当前位置: 首页>>代码示例>>Java>>正文


Java NotYetBoundException类代码示例

本文整理汇总了Java中java.nio.channels.NotYetBoundException的典型用法代码示例。如果您正苦于以下问题:Java NotYetBoundException类的具体用法?Java NotYetBoundException怎么用?Java NotYetBoundException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NotYetBoundException类属于java.nio.channels包,在下文中一共展示了NotYetBoundException类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSerializationSelf

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
/**
 * @tests serialization/deserialization compatibility.
 */
@TestTargets({
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        notes = "Verifies serialization/deserialization compatibility.",
        method = "!SerializationSelf",
        args = {}
    ),
    @TestTargetNew(
        level = TestLevel.PARTIAL_COMPLETE,
        notes = "Verifies serialization/deserialization compatibility.",
        method = "NotYetBoundException",
        args = {}
    )
})
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new NotYetBoundException());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:NotYetBoundExceptionTest.java

示例2: testSerializationCompatibility

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
/**
 * @tests serialization/deserialization compatibility with RI.
 */
@TestTargets({
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        notes = "Verifies serialization/deserialization compatibility.",
        method = "!SerializationGolden",
        args = {}
    ),
    @TestTargetNew(
        level = TestLevel.PARTIAL_COMPLETE,
        notes = "Verifies serialization/deserialization compatibility.",
        method = "NotYetBoundException",
        args = {}
    )
})
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new NotYetBoundException());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:NotYetBoundExceptionTest.java

示例3: associations

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
@Override
public Set<Association> associations()
        throws ClosedChannelException, NotYetBoundException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (!isBound())
            throw new NotYetBoundException();

        return Collections.unmodifiableSet(associationMap.keySet());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:SctpMultiChannelImpl.java

示例4: accept

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
public SocketChannel accept () throws IOException
{
  if (!isOpen())
    throw new ClosedChannelException();

  if (!serverSocket.isBound())
    throw new NotYetBoundException();

  boolean completed = false;

  try
    {
      begin();
      VMChannel client = channel.accept();
      if (client == null)
        return null;
      else
        {
          completed = true;
          return new SocketChannelImpl(provider(), client, false);
        }
    }
  finally
    {
      end (completed);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:28,代码来源:ServerSocketChannelImpl.java

示例5: accept

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
public SocketChannel accept () throws IOException
{
  if (!isOpen())
    throw new ClosedChannelException();

  if (!serverSocket.isBound())
    throw new NotYetBoundException();

  boolean completed = false;
  
  try
    {
      begin();
      VMChannel client = channel.accept();
      if (client == null)
        return null;
      else
        {
          completed = true;
          return new SocketChannelImpl(provider(), client, false);
        }
    }
  finally
    {
      end (completed);
    }
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:28,代码来源:ServerSocketChannelImpl.java

示例6: accept

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
@Override
public SocketChannel accept() throws IOException {
    if (!isOpen()) {
        throw new ClosedChannelException();
    }
    if (!socket.isBound()) {
        throw new NotYetBoundException();
    }

    // Create an empty socket channel. This will be populated by ServerSocketAdapter.implAccept.
    SocketChannelImpl result = new SocketChannelImpl(provider(), false);
    try {
        begin();
        synchronized (acceptLock) {
            try {
                socket.implAccept(result);
            } catch (SocketTimeoutException e) {
                if (shouldThrowSocketTimeoutExceptionFromAccept(e)) {
                    throw e;
                }
                // Otherwise, this is a non-blocking socket and there's nothing ready, so we'll
                // fall through and return null.
            }
        }
    } finally {
        end(result.isConnected());
    }
    return result.isConnected() ? result : null;
}
 
开发者ID:Sellegit,项目名称:j2objc,代码行数:30,代码来源:ServerSocketChannelImpl.java

示例7: test_Constructor

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
/**
 * @tests {@link java.nio.channels.NotYetBoundException#NotYetBoundException()}
 */
public void test_Constructor() {
    NotYetBoundException e = new NotYetBoundException();
    assertNull(e.getMessage());
    assertNull(e.getLocalizedMessage());
    assertNull(e.getCause());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:10,代码来源:NotYetBoundExceptionTest.java

示例8: testAccept_Block_NotYetBound

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
public void testAccept_Block_NotYetBound() throws IOException {
    assertTrue(this.serverChannel.isOpen());
    assertTrue(this.serverChannel.isBlocking());
    try {
        this.serverChannel.accept();
        fail("Should throw NotYetBoundException"); 
    } catch (NotYetBoundException e) {
        // correct
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:11,代码来源:ServerSocketChannelTest.java

示例9: testAccept_NonBlock_NotYetBound

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
public void testAccept_NonBlock_NotYetBound() throws IOException {
    assertTrue(this.serverChannel.isOpen());
    this.serverChannel.configureBlocking(false);
    try {
        this.serverChannel.accept();
        fail("Should throw NotYetBoundException"); 
    } catch (NotYetBoundException e) {
        // correct
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:11,代码来源:ServerSocketChannelTest.java

示例10: accept

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
@Override public SocketChannel accept() throws IOException {
    if (!isOpen()) {
        throw new ClosedChannelException();
    }
    if (!isBound) {
        throw new NotYetBoundException();
    }

    // TODO: pass in the SelectorProvider used to create this ServerSocketChannelImpl?
    // Create an empty socket channel. This will be populated by ServerSocketAdapter.accept.
    SocketChannelImpl result = new SocketChannelImpl(SelectorProvider.provider(), false);
    Socket resultSocket = result.socket();

    try {
        begin();
        synchronized (acceptLock) {
            synchronized (blockingLock()) {
                boolean isBlocking = isBlocking();
                if (!isBlocking) {
                    int[] tryResult = new int[1];
                    boolean success = Platform.getNetworkSystem().select(
                            new FileDescriptor[] { fd },
                            new FileDescriptor[0], 1, 0, 0, tryResult);
                    if (!success || 0 == tryResult[0]) {
                        // no pending connections, returns immediately.
                        return null;
                    }
                }
                // do accept.
                do {
                    try {
                        socket.accept(resultSocket, result);
                        // select successfully, break out immediately.
                        break;
                    } catch (SocketTimeoutException e) {
                        // continue to accept if the channel is in blocking mode.
                    }
                } while (isBlocking);
            }
        }
    } finally {
        end(resultSocket.isConnected());
    }
    return result;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:46,代码来源:ServerSocketChannelImpl.java

示例11: accept

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
public SocketChannel accept() throws IOException {
    if (!isOpen()) {
        throw new ClosedChannelException();
    }
    if (!isBound) {
        throw new NotYetBoundException();
    }

    SocketChannel sockChannel = new SocketChannelImpl(SelectorProvider.provider(), false);
    Socket socketGot = sockChannel.socket();

    try {
        begin();

        synchronized (acceptLock) {
                boolean isBlocking = isBlocking();
                if (!isBlocking) {
                    // for non blocking mode, use select to see whether
                    // there are any pending connections.
                    int[] tryResult = new int[1];
                    boolean success = Platform.getNetworkSystem().select(
                            new FileDescriptor[] { this.fd },
                            new FileDescriptor[0], 1, 0, 0, tryResult);
                    if (!success || 0 == tryResult[0]) {
                        // no pending connections, returns immediately.
                        return null;
                    }
                }
                // do accept.
                do {
                    try {
                        ((ServerSocketAdapter) socket).accept(socketGot,
                                (SocketChannelImpl) sockChannel);
                        // select successfully, break out immediately.
                        break;
                    } catch (SocketTimeoutException e) {
                        // continue to accept if the channel is in blocking
                        // mode.
                    }
                } while (isBlocking);
        }
    } finally {
        end(socketGot.isConnected());
    }
    return sockChannel;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:47,代码来源:ServerSocketChannelImpl.java

示例12: testSerializationSelf

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
/**
 * @tests serialization/deserialization compatibility.
 */
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new NotYetBoundException());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:NotYetBoundExceptionTest.java

示例13: testSerializationCompatibility

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new NotYetBoundException());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:NotYetBoundExceptionTest.java

示例14: accept

import java.nio.channels.NotYetBoundException; //导入依赖的package包/类
public SocketChannel accept() throws IOException {
    if (!isOpen()) {
        throw new ClosedChannelException();
    }
    if (!isBound) {
        throw new NotYetBoundException();
    }

    SocketChannel sockChannel = SocketChannel.open();
    Socket socketGot = sockChannel.socket();

    try {
        begin();

        synchronized (acceptLock) {
            synchronized (blockingLock()) {
                boolean isBlocking = isBlocking();
                if (!isBlocking) {
                    // for non blocking mode, use select to see whether
                    // there are any pending connections.
                    int[] tryResult = Platform.getNetworkSystem().select(
                            new FileDescriptor[] { this.fd },
                            new FileDescriptor[0], 0);
                    if (0 == tryResult.length || 0 == tryResult[0]) {
                        // no pending connections, returns immediately.
                        return null;
                    }
                }
                // do accept.
                do {
                    try {
                        ((ServerSocketAdapter) socket).accept(socketGot,
                                (SocketChannelImpl) sockChannel);
                        // select successfully, break out immediately.
                        break;
                    } catch (SocketTimeoutException e) {
                        // continue to accept if the channel is in blocking
                        // mode.
                    }
                } while (isBlocking);
            }
        }
    } finally {
        end(socketGot.isConnected());
    }
    return sockChannel;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:48,代码来源:ServerSocketChannelImpl.java


注:本文中的java.nio.channels.NotYetBoundException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。