/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*
*/
// ActiveDiscoverer.java: Object to perform active DA discovery.
// Author: James Kempf
// Created On: Thu Sep 3 08:45:21 1998
// Last Modified By: James Kempf
// Last Modified On: Thu Jan 28 15:45:45 1999
// Update Count: 32
//
/*
* The ActiveDiscover does active discovery DA discovery by periodically
* sending out a SrvRqst for "service:directory-agent". Replies are
* entered into the DA table.
*
* @author James Kempf
*/
// Config object.
// Message for active DA discovery.
// Version of protocol to use for advertisements.
// DATable where discovered DAs are recorded.
// Scopes to advertise for.
// Address on which to advertise.
// Create an active discoverer.
}
}
// Do an initial active discovery then start a thread to
// do one periodically.
public void start() {
// Initial sleepy time.
// Create a message for active discovery.
try {
"");
} catch (ServiceLocationException ex) {
"sdat_active_err",
new Object[] {
ex.getMessage()});
}
// Initialize preconfigured DAs.
// Do an initial round of active discovery, waiting for
// a random period first. Only do it if active
// discovery is on.
try {
} catch (InterruptedException ex) {
}
} else {
// Report that active discovery is off.
new Object[0]);
}
// Start the active discovery thread.
super.start();
}
// Implement the Runnable interface for a thread to start.
public void run() {
// Set the Thread name.
// Sleepy time until discovery.
// If the sleep time is zero, then active discovery is turned off.
// Use the service URL maximum lifetime.
if (sleepyTime <= 0) {
}
// Register ourselves at startup if we are a DA. We may not be
// listening for the active discovery message at startup
// because the listener thread goes on-line last of all.
int i, n = interfaces.size();
for (i = 0; i < n; i++) {
"://" +
// but noforwarding because it is to us...
mySPIs);
}
}
// Sleep, then perform active discovery or polling of preconfigured
// DAs when we awake.
do {
try {
} else {
}
} catch (InterruptedException ex) {
}
} while (true);
}
// Perform active DA discovery.
synchronized private void activeDiscovery() {
// Set the previous responders list to null. Otherwise,
// the previous responders from the last time we did
// this may interfere.
// Perform the active discovery message transaction.
try {
table);
} catch (ServiceLocationException ex) {
ex.getMessage() });
}
}
// Add preconfigured DAs to the DA table. Note that we poll the
// preconfigured DAs once every 9 hours to make sure they are still around.
synchronized private void addPreconfiguredDAs() {
// Go through the DA addresses, contacting them for their
// information. Better not be any SLPv1 DAs there.
for (i = 0; i < n; i++) {
// Use a TCP connection. DAs must support TCP so why not?
try {
} catch (ServiceLocationException ex) {
ex.getMessage() });
}
continue;
}
// Report if there's an error in configuration.
}
continue;
}
// We need to make the URL long lived if active
// discovery is off. Otherwise, we let the DA time out like all the
// rest.
}
// Add the scopes to the configured scopes. Scopes from configured
// DAs count as configured scopes.
// Record it. Note that we don't have to forward here
// because it's the very beginning.
}
}
}