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


Java Association.associationID方法代码示例

本文整理汇总了Java中com.sun.nio.sctp.Association.associationID方法的典型用法代码示例。如果您正苦于以下问题:Java Association.associationID方法的具体用法?Java Association.associationID怎么用?Java Association.associationID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.nio.sctp.Association的用法示例。


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

示例1: setOption

import com.sun.nio.sctp.Association; //导入方法依赖的package包/类
@Override
public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
                                      T value,
                                      Association association)
        throws IOException {
    if (name == null)
        throw new NullPointerException();
    if (!(supportedOptions().contains(name)))
        throw new UnsupportedOperationException("'" + name + "' not supported");

    synchronized (stateLock) {
        if (association != null && (name.equals(SCTP_PRIMARY_ADDR) ||
                name.equals(SCTP_SET_PEER_PRIMARY_ADDR))) {
            checkAssociation(association);
        }
        if (!isOpen())
            throw new ClosedChannelException();

        int assocId = association == null ? 0 : association.associationID();
        SctpNet.setSocketOption(fdVal, name, value, assocId);
    }
    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:SctpMultiChannelImpl.java

示例2: getOption

import com.sun.nio.sctp.Association; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T> T getOption(SctpSocketOption<T> name, Association association)
        throws IOException {
    if (name == null)
        throw new NullPointerException();
    if (!supportedOptions().contains(name))
        throw new UnsupportedOperationException("'" + name + "' not supported");

    synchronized (stateLock) {
        if (association != null && (name.equals(SCTP_PRIMARY_ADDR) ||
                name.equals(SCTP_SET_PEER_PRIMARY_ADDR))) {
            checkAssociation(association);
        }
        if (!isOpen())
            throw new ClosedChannelException();

        int assocId = association == null ? 0 : association.associationID();
        return (T)SctpNet.getSocketOption(fdVal, name, assocId);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:SctpMultiChannelImpl.java

示例3: addAssociation

import com.sun.nio.sctp.Association; //导入方法依赖的package包/类
private void addAssociation(Association association) {
    synchronized (stateLock) {
        int assocId = association.associationID();
        Set<SocketAddress> addresses = null;

        try {
            addresses = SctpNet.getRemoteAddresses(fdVal, assocId);
        } catch (IOException unused) {
            /* OK, determining connected addresses may not be possible
             * shutdown, connection lost, etc */
        }

        associationMap.put(association, addresses);
        if (addresses != null) {
            for (SocketAddress addr : addresses)
                addressMap.put(addr, association);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:SctpMultiChannelImpl.java

示例4: lookupAssociation

import com.sun.nio.sctp.Association; //导入方法依赖的package包/类
private Association lookupAssociation(int assocId) {
    /* Lookup the association in our internal map */
    synchronized (stateLock) {
        Set<Association> assocs = associationMap.keySet();
        for (Association a : assocs) {
            if (a.associationID() == assocId) {
                return a;
            }
        }
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:SctpMultiChannelImpl.java

示例5: removeAssociation

import com.sun.nio.sctp.Association; //导入方法依赖的package包/类
private void removeAssociation(Association association) {
    synchronized (stateLock) {
        int assocId = association.associationID();
        Set<SocketAddress> addresses = null;

         try {
            addresses = SctpNet.getRemoteAddresses(fdVal, assocId);
        } catch (IOException unused) {
            /* OK, determining connected addresses may not be possible
             * shutdown, connection lost, etc */
        }

        Set<Association> assocs = associationMap.keySet();
        for (Association a : assocs) {
            if (a.associationID() == assocId) {
                associationMap.remove(a);
                break;
            }
        }
        if (addresses != null) {
            for (SocketAddress addr : addresses)
                addressMap.remove(addr);
        } else {
            /* We cannot determine the connected addresses */
            Set<java.util.Map.Entry<SocketAddress, Association>> addrAssocs =
                    addressMap.entrySet();
            Iterator<Entry<SocketAddress, Association>> iterator = addrAssocs.iterator();
            while (iterator.hasNext()) {
                Entry<SocketAddress, Association> entry = iterator.next();
                if (entry.getValue().equals(association)) {
                    iterator.remove();
                }
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:SctpMultiChannelImpl.java


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