Package com.sun.jini.discovery

Examples of com.sun.jini.discovery.Discovery


   * interrupted, otherwise return true.
   */
  private boolean announce(String[] groups) {
      // REMIND: cache latest announcement to skip re-encoding
      List packets = new ArrayList();
      Discovery disco;
      try {
    disco = getDiscovery(
        multicastAnnouncementConstraints.chooseProtocolVersion());
      } catch (DiscoveryProtocolException e) {
    throw new AssertionError(e);
      }
      EncodeIterator ei = disco.encodeMulticastAnnouncement(
    new MulticastAnnouncement(System.currentTimeMillis(),
            lookupLocator.getHost(),
            lookupLocator.getPort(),
            groups,
            lookupServiceID),
View Full Code Here


  private boolean announce(String[] groups) {
      if (dataPackets == null || !lastLocator.equals(myLocator) ||
          !Arrays.equals(lastGroups, groups))
      {
          List packets = new ArrayList();
          Discovery disco;
          try {
        disco = getDiscovery(multicastAnnouncementConstraints
           .chooseProtocolVersion());
          } catch (DiscoveryProtocolException e) {
        throw new AssertionError(e);
          }
          EncodeIterator ei = disco.encodeMulticastAnnouncement(
        new MulticastAnnouncement(announcementSeqNo++,
            myLocator.getHost(),
            myLocator.getPort(),
            groups,
            myServiceID),
View Full Code Here

    pkt.getData(), pkt.getOffset(), pkt.getLength()).getInt();
  } catch (BufferUnderflowException e) {
      throw new DiscoveryProtocolException(null, e);
  }
  multicastAnnouncementConstraints.checkProtocolVersion(pv);
  final Discovery disco = getDiscovery(pv);

  try {
      return (MulticastAnnouncement) AccessController.doPrivileged(
    securityContext.wrap(new PrivilegedExceptionAction() {
        public Object run() throws IOException {
      return disco.decodeMulticastAnnouncement(
          pkt,
          multicastAnnouncementConstraints.
        getUnfulfilledConstraints(),
        true);
        }
View Full Code Here

     */
    private DatagramPacket[] encodeMulticastRequest(final MulticastRequest req)
  throws IOException
    {
  // REMIND: cache latest request to skip re-encoding
  final Discovery disco = getDiscovery(
      multicastRequestConstraints.chooseProtocolVersion());
  final List packets = new ArrayList();
  AccessController.doPrivileged(
      securityContext.wrap(new PrivilegedAction() {
    public Object run() {
        EncodeIterator ei = disco.encodeMulticastRequest(
      req,
      multicastRequestConstraints.getMulticastMaxPacketSize(
          DEFAULT_MAX_PACKET_SIZE),
      multicastRequestConstraints.getUnfulfilledConstraints()
        );
View Full Code Here

    private UnicastResponse doUnicastDiscovery(
      final Socket socket,
      final DiscoveryConstraints unicastDiscoveryConstraints)
  throws IOException, ClassNotFoundException
    {
  Discovery disco =
      getDiscovery(unicastDiscoveryConstraints.chooseProtocolVersion());
  return doUnicastDiscovery(socket, unicastDiscoveryConstraints, disco);
    }
View Full Code Here

      // We'll just try to use the host name later anyway.
  }
 
  DiscoveryConstraints dc = DiscoveryConstraints.process(constraints);
  int pv = dc.chooseProtocolVersion();
  Discovery disco;
  switch (pv) {
      case Discovery.PROTOCOL_VERSION_1:
    disco = Discovery.getProtocol1();
    break;
      case Discovery.PROTOCOL_VERSION_2:
View Full Code Here

      // We'll just try to use the host name later anyway.
  }
 
  DiscoveryConstraints dc = DiscoveryConstraints.process(constraints);
  int pv = dc.chooseProtocolVersion();
  Discovery disco;
  switch (pv) {
      case Discovery.PROTOCOL_VERSION_1:
    disco = Discovery.getProtocol1();
    break;
      case Discovery.PROTOCOL_VERSION_2:
View Full Code Here

    pkt.getData(), pkt.getOffset(), pkt.getLength()).getInt();
  } catch (BufferUnderflowException e) {
      throw new DiscoveryProtocolException(null, e);
  }
  multicastAnnouncementConstraints.checkProtocolVersion(pv);
  final Discovery disco = getDiscovery(pv);

  try {
      return (MulticastAnnouncement) AccessController.doPrivileged(
    securityContext.wrap(new PrivilegedExceptionAction() {
        public Object run() throws IOException {
      return disco.decodeMulticastAnnouncement(
          pkt,
          multicastAnnouncementConstraints.
        getUnfulfilledConstraints(),
        true);
        }
View Full Code Here

     */
    private DatagramPacket[] encodeMulticastRequest(final MulticastRequest req)
  throws IOException
    {
  // REMIND: cache latest request to skip re-encoding
  final Discovery disco = getDiscovery(
      multicastRequestConstraints.chooseProtocolVersion());
  final List packets = new ArrayList();
  AccessController.doPrivileged(
      securityContext.wrap(new PrivilegedAction() {
    public Object run() {
        EncodeIterator ei = disco.encodeMulticastRequest(
      req,
      multicastRequestConstraints.getMulticastMaxPacketSize(
          DEFAULT_MAX_PACKET_SIZE),
      multicastRequestConstraints.getUnfulfilledConstraints()
        );
View Full Code Here

    private UnicastResponse doUnicastDiscovery(
      final Socket socket,
      final DiscoveryConstraints unicastDiscoveryConstraints)
  throws IOException, ClassNotFoundException
    {
  Discovery disco =
      getDiscovery(unicastDiscoveryConstraints.chooseProtocolVersion());
  return doUnicastDiscovery(socket, unicastDiscoveryConstraints, disco);
    }
View Full Code Here

TOP

Related Classes of com.sun.jini.discovery.Discovery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.