Java Code Examples for com.sun.nio.sctp.Association#associationID()
The following examples show how to use
com.sun.nio.sctp.Association#associationID() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SctpMultiChannelImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@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; }
Example 2
Source File: SctpMultiChannelImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
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); } } }
Example 3
Source File: SctpMultiChannelImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@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); } }
Example 4
Source File: SctpMultiChannelImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
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); } } }
Example 5
Source File: SctpMultiChannelImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
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); } } }
Example 6
Source File: SctpMultiChannelImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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); } } }
Example 7
Source File: SctpMultiChannelImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
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); } } }
Example 8
Source File: SctpMultiChannelImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@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; }
Example 9
Source File: SctpMultiChannelImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
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); } } }
Example 10
Source File: SctpMultiChannelImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
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); } } }
Example 11
Source File: SctpMultiChannelImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@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; }
Example 12
Source File: SctpMultiChannelImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@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; }
Example 13
Source File: SctpMultiChannelImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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(); } } } } }
Example 14
Source File: SctpMultiChannelImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
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(); } } } } }
Example 15
Source File: SctpMultiChannelImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
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(); } } } } }
Example 16
Source File: SctpMultiChannelImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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; }
Example 17
Source File: SctpMultiChannelImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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; }
Example 18
Source File: SctpMultiChannelImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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(); } } } } }
Example 19
Source File: SctpMultiChannelImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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; }
Example 20
Source File: SctpMultiChannelImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
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; }