< prev index next >

src/java.base/share/classes/java/net/MulticastSocket.java

Print this page
M MulticastSocket.java


 791                                                         " differ");
 792                         }
 793                     }
 794                     byte dttl = getTTL();
 795                     try {
 796                         if (ttl != dttl) {
 797                             // set the ttl
 798                             getImpl().setTTL(ttl);
 799                         }
 800                         // call the datagram method to send
 801                         getImpl().send(p);
 802                     } finally {
 803                         // set it back to default
 804                         if (ttl != dttl) {
 805                             getImpl().setTTL(dttl);
 806                         }
 807                     }
 808                 } // synch p
 809             }  //synch ttl
 810     } //method
 811 
 812     private static Set<SocketOption<?>> options;
 813     private static boolean optionsSet = false;
 814 
 815     @Override
 816     public Set<SocketOption<?>> supportedOptions() {
 817         synchronized (MulticastSocket.class) {
 818             if (optionsSet) {
 819                 return options;
 820             }
 821             try {
 822                 DatagramSocketImpl impl = getImpl();
 823                 options = Collections.unmodifiableSet(impl.supportedOptions());
 824             } catch (SocketException ex) {
 825                 options = Collections.emptySet();
 826             }
 827             optionsSet = true;
 828             return options;
 829         }
 830     }
 831 }


 791                                                         " differ");
 792                         }
 793                     }
 794                     byte dttl = getTTL();
 795                     try {
 796                         if (ttl != dttl) {
 797                             // set the ttl
 798                             getImpl().setTTL(ttl);
 799                         }
 800                         // call the datagram method to send
 801                         getImpl().send(p);
 802                     } finally {
 803                         // set it back to default
 804                         if (ttl != dttl) {
 805                             getImpl().setTTL(dttl);
 806                         }
 807                     }
 808                 } // synch p
 809             }  //synch ttl
 810     } //method




















 811 }
< prev index next >